简体   繁体   English

当我尝试将元素传递给HTTP请求时发生错误

[英]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.expMonthNSUInteger 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.

相关问题 当我尝试在iOS应用程序中传递NSURL中的参数时,为什么会出现此错误? - Why do I get this error when I try to pass a parameter in NSURL in iOS app? 当我尝试传递字符串时谓词不起作用 - Predicate not working when I try to pass string 当我发送到许多请求时,为什么会出现此错误(HTTP错误400)? - Why i am getting this error (HTTP error 400.) when I send to many request? 尝试使用其响应时,异步http调用未准备好 - Asynchronous http call is not ready when I try to use its response 当我尝试传递第二个字符时,BEGINWITH谓词不起作用 - BEGINWITH predicate not working when i try to pass second character 当我尝试删除UITableViewCell时,出现以下错误:无效的更新:第0节中的行数无效,但是我似乎无法修复它 - When I try to remove a UITableViewCell, I get this error: Invalid update: invalid number of rows in section 0, but I can't seem to fix it 使用nsurlconnection SynchronousRequest重定向后的GET http请求方法 - GET http request method after redirect when using nsurlconnection SynchronousRequest 当我尝试让OSX上的p4 cmd线路客户端执行某项操作时,它总是会通过错误… - p4 cmd line client on OSX always throughs error when I try to get it to do something… p4v works fine 当我尝试通过标签获取文本字段的值时,应用崩溃 - App crashes when I try to get value of textfield by tag 当我尝试使用MPVolumeView进行编译时,xcode中出现错误 - Error in xcode when i try to compile using a MPVolumeView
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM