XCode からアプリを実行してもアプリはクラッシュしませんが、TestFlight で使用する IPA を作成したところ、ユーザーがアプリにログインしようとするとクラッシュします。ここで定義されている keychainItemWrapper ライブラリを使用しているためだと思います: https://gist.github.com/dhoerl/1170641
これは私のクラッシュレポートがどのように見えるかです:
Incident Identifier: 906A698B-555F-4922-8596-27FE481E9522
CrashReporter Key: 8722e51d4300c003d1ac939808b1a9c67f112194
Hardware Model: iPhone6,1
Process: -
Path: /var/mobile/Applications/B2EFB5F3-86C0-4E87-850D-27F771A1FA41/App.app/App
Identifier: -
Version: 1.0 (1.0)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
Date/Time: 2014-09-08 21:10:03.911 -0400
OS Version: iOS 7.1.2 (11D257)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x000000008945bec8
Triggered by Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x00000001991ac0b8 objc_retain + 24
1 App 0x000000010008118c -[LoginViewController loginClick:] (LoginViewController.m:246)
...
LoginViewController の 246 行目で、次のメソッドを実行します。
[self authenticateUser];
以下に定義されています。
-(IBAction)authenticateUser {
[keychainItem resetKeychainItem]; // remove any existing auth_token
[keychainItem setObject:[_txtUsername text] forKey:(__bridge id)(kSecAttrAccount)];
NSURL *url=[NSURL URLWithString:sessionsBaseURL];
NSError *error = [[NSError alloc] init];
NSDictionary * userDict = [[NSDictionary alloc] initWithObjectsAndKeys: [_txtUsername text], @"username", [_txtPassword text], @"password", nil];
NSDictionary * holderDict = [[NSDictionary alloc] initWithObjectsAndKeys: userDict, @"user", nil];
NSLog(@"user holderDict: %@", holderDict);
NSData * holder = [NSJSONSerialization dataWithJSONObject:holderDict options:0 error:&error];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:url];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:holder];
NSURLResponse * response = nil;
NSData * receivedData = nil;
receivedData = [NSMutableData data];
receivedData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
// get dictionary from json data
NSDictionary * jsonResponse = [NSJSONSerialization
JSONObjectWithData: receivedData
options:kNilOptions
error:&error];
NSLog(@"jsonResponse: %@", jsonResponse);
NSDictionary * dataResponse = [jsonResponse objectForKey:@"data"];
auth_token = [dataResponse objectForKey:@"auth_token"];
// save user authentication token in NSUserDefaults
NSUserDefaults* preferences = [NSUserDefaults standardUserDefaults];
[keychainItem setObject:[dataResponse objectForKey:@"auth_token"] forKey:(__bridge id)(kSecValueData)];
[self checkLoginApproved];
}
アプリのリリースを妨げているため、これについて何か助けていただければ幸いです。