【发布时间】:2013-12-07 19:05:06
【问题描述】:
我有以下字典:
NSDictionary* jsonDict = @{
@"firstName": txtFirstName.text,
@"lastName": txtLastName.text,
@"email": txtEmailAddress.text,
@"password": txtPassword.text,
@"imageUrl": imageUrl,
@"facebookId": [fbId integerValue],
};
在最后一个元素中,我需要使用整数,但收到错误消息:
collection element of type int is not an objective c object
如何在此元素中使用 int 值?
【问题讨论】:
-
@"facebookId" : [fbId integerValue]应该是@"facebookId" : @([fbId longLongValue])。然而,在 Swift 中,数字没有强制转换要求:即let jsonDict = [..., "facebookId" : fbId.longLongValue() ]
标签: ios nsdictionary