当我尝试将元素传递给 HTTP 请求时出现错误
Get an error when I try to pass an element to an HTTP request
错误:
collection element of type nsuinteger aka unsigned long is not an
objective c object
我正在尝试向 stripe 发出 http 请求。这是参数的样子
@"card": card.number, @"exp_month": card.expMonth, @"exp_year": card.expYear, @"cvc": card.cvc
card.expMonth 是导致错误的原因。我尝试在前面添加 (unsigned long),但出现错误
collection element of type 'unsigned long' is not an objective c object
如何发送月份元素?
你发的"code"不是很清楚。但是card.expMonth
好像是一个NSUInteger
。您需要将此类基本类型包装在 NSNumber
个对象中。
通过更改来做到这一点:
card.expMonth
到
@(card.expMonth)
对表示原始数字类型的任何值执行此操作。
错误:
collection element of type nsuinteger aka unsigned long is not an objective c object
我正在尝试向 stripe 发出 http 请求。这是参数的样子
@"card": card.number, @"exp_month": card.expMonth, @"exp_year": card.expYear, @"cvc": card.cvc
card.expMonth 是导致错误的原因。我尝试在前面添加 (unsigned long),但出现错误
collection element of type 'unsigned long' is not an objective c object
如何发送月份元素?
你发的"code"不是很清楚。但是card.expMonth
好像是一个NSUInteger
。您需要将此类基本类型包装在 NSNumber
个对象中。
通过更改来做到这一点:
card.expMonth
到
@(card.expMonth)
对表示原始数字类型的任何值执行此操作。