“BOOL 类型的集合元素"不是objective-c对象 [英] "collection element of type BOOL" is not an objective-c object
本文介绍了“BOOL 类型的集合元素"不是objective-c对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人知道我为什么会得到这个吗?
Anyone have a clue why I am getting this?
-(void)postPrimaryEMWithEM:(EM *)em
exclusive:(BOOL) isExclusive
success:(void (^)())onSuccess
failure:(void (^)())onFailure {
if(self.accessToken) {
GenericObject *genObject = [[GenericObject alloc] init];
[[RKObjectManager sharedManager] postObject:genObject
path:@"users/update.json"
parameters:@{
...
@"em_id" : ObjectOrNull(em.emID),
@"exclusive": isExclusive <-- error message
推荐答案
您不能将基本数据类型放入字典中.它必须是一个对象.但是你可以使用 [NSNumber numberWithBool:isExclusive]
或使用 @(isExclusive)
语法:
You cannot put a fundamental data type in a dictionary. It must be an object. But you can use [NSNumber numberWithBool:isExclusive]
or use the @(isExclusive)
syntax:
[[RKObjectManager sharedManager] postObject:genObject
path:@"users/update.json"
parameters:@{
...
@"em_id" : ObjectOrNull(em.emID),
@"exclusive": @(isExclusive), ...
<小时>
我也不怀疑您打算使用 BOOL *
作为参数.您大概是打算:
I also don't suspect you meant to use BOOL *
as your parameter. You presumably intended:
- (void)postPrimaryEMWithEM:(EM *)em
exclusive:(BOOL) isExclusive
success:(void (^)())onSuccess
failure:(void (^)())onFailure {
...
}
同样,BOOL
不是一个对象,所以 *
语法可能不是故意的.
Again, a BOOL
is not an object, so the *
syntax was presumably not intended.
这篇关于“BOOL 类型的集合元素"不是objective-c对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文