1
Profile *profile = [[Profile alloc] init];

NSLog(@"badgeId is %@", badgeId);

NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:[profile getAuthenticationToken], @"auth_token", badgeId, "badge_id", title, "title", nil];

メソッド getAuthenticationToken (文字列を返す) を返した後、静かにクラッシュします。メモリ参照に移動してからクラッシュするようです。前の行の BadgeId の println は、次を返します。

badgeId is 97
4

2 に答える 2

8

問題の 1 つは、C のような文字列"badge_id"が適切な NSDictionary キーではないことです。などの NSString オブジェクトを使用します@"badge_id"

于 2013-05-13T20:31:24.177 に答える
2

辞書のキーは、NSCopying-Protocol を実装するオブジェクトでなければなりません。C 文字列は (Objective-C) オブジェクトではないため、NSCopying を実装しません。

于 2013-05-13T20:41:44.327 に答える