[英]Get an error when I try to pass an element to an HTTP request
error: 错误:
collection element of type nsuinteger aka unsigned long is not an objective c object
类型为nsuinteger的集合元素,又称为unsigned long,不是目标c对象
I am trying to make an http request to stripe. 我正在尝试发出http请求以剥离。 This is what the params look like
这就是参数的样子
@"card": card.number, @"exp_month": card.expMonth, @"exp_year": card.expYear, @"cvc": card.cvc
The card.expMonth is whats causing the error. card.expMonth是导致错误的原因。 I tried adding (unsigned long) infront, but got the error
我尝试添加(unsigned long)infront,但是出现了错误
collection element of type 'unsigned long' is not an objective c object
类型为'unsigned long'的collection元素不是目标c对象
What can I do to send the month element? 如何发送月份元素?
The "code" you posted isn't very clear. 您发布的“代码”不是很清楚。 But it seems that
card.expMonth
is an NSUInteger
. 但是似乎
card.expMonth
是NSUInteger
。 You need to wrap such primitive types in NSNumber
objects. 您需要将此类原始类型包装在
NSNumber
对象中。
Do that by changing: 通过更改来做到这一点:
card.expMonth
to 至
@(card.expMonth)
Do this for any of the values that represent a primitive number type. 对表示原始数字类型的任何值执行此操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.