Search code examples
xcodegitkeychainibm-mobilefirstibm-cloud

mobilefirst native ios keychain wrapper issue


I am working on a project for a native iOS app using xcode to develop the project, but including both MobileFirst Platform Foundation capabilities and mobile data capabilities from Bluemix. We are using a shared git repository on IBM DevOps services (jazzhub) to share project source code and work collaboratively on it.

Most of the native apps I have built in the past have been on my own, so this is my first attempt to collaborate using git/xcode working together.

All that is just context for the issue, which is a project using the above environment on my collegues mac build/runs fine. Once I git clone the project and try to run it on my mac I am getting the following error:

*** Assertion failure in -[KeychainItemWrapper writeToKeychain], /tmp/builds/bld-00-20141218-1823-2824648/worklight-ios/framework-xcode-project/NativeSDK-Sources/WorkLight/KeychainItemWrapper.m:311
2015-01-31 13:16:27.657 IBMBankNativeApp[88827:11348297] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Couldn't add the Keychain Item.'

Above this message in the xcode log I see a secussful initialization of the Bluemix and the call to initialize the MFP connection:

2015-01-31 13:16:27.439 NativeApp[88827:11348297] INFO: IBMBluemix initialization successful.
IBMBluemix SDK Version: 1.0.1.20141124-1240
BlueMix Target: https://mybank.mybluemix.net
applicationId: ea36d23f-....
2015-01-31 13:16:27.530 NativeApp[88827:11348297] IBMData SDK initialization successful.
2015-01-31 13:16:27.580 NativeApp[88827:11348297] ViewController - connectToServer - Initializing ...
2015-01-31 13:16:27.591 NativeApp[88827:11348297] [DEBUG] [WL_CONFIG] -[WLConfig init] in WLConfig.m:68 :: {
    "application id" = NativeiOSApi;
    "application version" = "1.0";
    environment = iOSnative;
    host = "192.168.0.17";
    platformVersion = "6.3.0.00.20141218-1823";
    port = 10080;
    protocol = http;
    wlServerContext = "/MFProject/";
    wlUid = "wY/mbnwKTDDYQUvuQCdSgg==";
}

Before the MFP callback for initialization of the connection the application terminates with the keychain error.

I did not add the keychain access to the project, I'm using cocoapods to set-up bluemix support and wonder if that somehow is adding the keychain support?

I tried removing and running, removing then re-adding they keychain support in the project capabilities, all with the same error.

Is there something checked in and replicated by git that shouldn't be?

Thanks in advance!


Solution

  • Verify that the following Key exists under the Root key in both entitlements-debug.plist and entitlements-release.plist:

    Key: keychain-access-groups
    Type: Array

    Inside the above Key:
    Key: Item 0
    Type: String
    Value: $(AppIdentifierPrefix)worklight.group

    enter image description here