创建NSDictionary dictionaryWithObjectsAndKeys时无提示崩溃

jim*_*bob 1 objective-c nsdictionary ios

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

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

NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:[profile getAuthenticationToken], @"auth_token", badgeId, "badge_id", title, "title", nil];
Run Code Online (Sandbox Code Playgroud)

它在返回方法getAuthenticationToken(返回一个字符串)后静默崩溃.它似乎转到内存引用然后崩溃.返回以下内容的行上的badgeId上的println:

badgeId is 97
Run Code Online (Sandbox Code Playgroud)

mat*_*att 8

一个问题是类似C字符串"badge_id"不是一个好的NSDictionary密钥.使用NSString对象,例如@"badge_id".