Note that there are some explanatory texts on larger screens.

plurals
  1. POCan not save credentials in Keychain after resign app
    text
    copied!<p>I wrote an App which saves the user credentials in the iOS Keychain using the KeychainItemWrapper class. All works fine, but if the App is getting resigned for enterprise use, saving credentials do not work anymore.</p> <p>I get the following Error but the App is not crashing:</p> <pre><code>SecItemCopyMatching: missing entitlement securityd[2314] &lt;Error&gt;: Directory[2312] SecItemCopyMatching: missing entitlement securityd[2314] &lt;Error&gt;: Directory[2312] SecItemAdd: missing entitlement securityd[2314] &lt;Error&gt;: Directory[2312] SecItemCopyMatching: missing entitlement securityd[2314] &lt;Error&gt;: XYZ[2312] SecItemAdd: missing entitlement </code></pre> <p>I initiate the class a follows:</p> <pre><code>KeychainItemWrapper *wrapper = [[KeychainItemWrapper alloc] initWithIdentifier:@"MYAPP_credentials" accessGroup:nil]; [keychain setObject:userName forKey:(__bridge id)kSecAttrAccount]; [keychain setObject:password forKey:(__bridge id)kSecValueData]; </code></pre> <p>I tried also to create an Entitlements.plist (using XCode 4.5.2)</p> <p><img src="https://i.stack.imgur.com/hQmya.png" alt="enter image description here"></p> <p>and the following code:</p> <pre><code>KeychainItemWrapper *wrapper = [[KeychainItemWrapper alloc] initWithIdentifier:@"p7s1_dictionary" accessGroup:@"net.XYZ.directory"]; [keychain setObject:userName forKey:(__bridge id)kSecAttrAccount]; [keychain setObject:password forKey:(__bridge id)kSecValueData]; </code></pre> <p>While doing this I get an App crash with the following message:</p> <pre><code>Assertion failure in -[KeychainItemWrapper writeToKeychain], /Users/omid/Documents/Workspace/Xcode workspace/Directory/KeychainItemWrapper.m:305 2012-11-11 19:51:48.860 Directory[4162:907] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Couldn't add the Keychain Item.' First throw call stack: (0x32c7c2a3 0x33b3a97f 0x32c7c15d 0x348252af 0x32cbf 0x3230f 0x43aad 0x3488aef5 0x347ca9f1 0x347ca90d 0x39d9d5df 0x39d9cccb 0x39dc5133 0x32bc274d 0x39dc5593 0x39d2915d 0x32c51683 0x32c50ee9 0x32c4fcb7 0x32bc2ebd 0x32bc2d49 0x3a9c02eb 0x3a47e2f9 0x1ac69 0x1a140) </code></pre> <p>Update: That's the script I use to resign</p> <pre><code>IPA="path to the .ipa file" PROVISION="path to the .mobileprovision file" CERTIFICATE="iPhone Distribution: a name" export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/usr/bin/codesign_allocate" unzip -q "$IPA" rm -rf Payload/*.app/_CodeSignature Payload/*.app/CodeResources cp "$PROVISION" Payload/*.app/embedded.mobileprovision /usr/bin/codesign -f -s "$CERTIFICATE" --resource-rules Payload/*.app/ResourceRules.plist Payload/*.app zip -qr resigned.ipa Payload rm -rf Payload </code></pre> <p>I would be thankful for any hint.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload