有人知道我为什么会收到这个吗?
-(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
(void)postPrimaryEMWithEM:(EM *)em exclusive:(BOOL)isExclusive success:(void (^)())onSuccess failure:(void (^)())onFailure
- logixologistisExclusive
应该是BOOL *
而不仅仅是BOOL
吗?实际上你可能有两个问题。如果参数的目的是将值返回给调用者,则使用BOOL *
是可以的。 - rmaddyBOOL*
是指向BOOL
的指针。有合法的使用场景,但这不是其中之一。跳过*
。 (并尝试学习更多关于“东西”和“指向东西的指针”之间的区别 - 这对于在 Objective-C 中编程至关重要。) - Hot LickspostPrimaryEMWithEM
方法的参数,但是你仍然需要在RKObjectManager
方法中使用@(isExclusive)
语法(或者[NSNumber numberWithBool:isExclusive]
)。如果你这样做,它将正确地将布尔值表示为JSON中的true
或false
。 - Rob