In my iOS app, I am using KeychainItemWrapper given by Apple to save some important data of my app.
App works fine when I deploy app on mobile using developer provisioning profile, but when same app I deploy by creating distribution build using "Distribution" profile app crashes.
I analyzed device log but not able to figure out the issue. It crashes "writeToKeyChain" method. I am not able to find out why this is happening only for distribution profile build.
Any Idea why this is happening? Any one faced this issue before?
iOS : 9.3.1
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
CoreFoundation 0x1817fee38 __exceptionPreprocess + 124
1 libobjc.A.dylib 0x180e63f80 objc_exception_throw + 56
2 CoreFoundation 0x1817fed08 +[NSException raise:format:arguments:] + 108
3 Foundation 0x182184124 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 112
4 MyApp 0x10017fe6c -[KeychainItemWrapper writeToKeychain] (KeychainItemWrapper.m:328)
5 MyApp 0x10017f1c4 -[KeychainItemWrapper setObject:forKey:] (KeychainItemWrapper.m:177)
6 MyApp 0x1000c61cc +[MyKeyChainWrappper fetchInfo:] (MyKeyChainWrappper.m:41)
EDIT:
KeychainItemWrapper Initialisation code
KeychainItemWrapper* mykeyChain = [[KeychainItemWrapper alloc] initWithIdentifier:@"My_Identifier" accessGroup:[[NSBundle mainBundle] bundleIdentifier]];
[mykeyChain setObject:(__bridge id)(kSecAttrAccessibleWhenUnlocked) forKey:(__bridge id)(kSecAttrAccessible)];