XCode 9.2 Issue loading app onto device, but simulator works just fine


Hey @ido,
I just updated Xcode to version 9.2 and the CocoaPods Pod File in my Xcode project ( which is written in Swift) to use:
pod 'Particle-SDK’
pod ‘ParticleSetup’

instead of

pod 'Spark-SDK’
pod ‘SparkSetup’

After going through and updating all the code inside the project everything is running fine in the simulator, but when I try to build the app on my iPhone, I am getting a strange crash and wondered if anyone could shed any light on this issue.

This crash is occuring directly after entering my login information into the ParticleSetupMainController and clicking login.
I redacted a couple spots, but you should still be able to see the what im doing. Here are my login functions, which work fine in the simulator, but crash on the iPhone. I a

func mySparkCloudLogin(){

    guard let setupController = ParticleSetupMainController.init(authenticationOnly: true) else{return}

    setupController.delegate = self
    self.present(setupController, animated: true, completion: nil)

func customMyCarSetup(){

    let custom = ParticleSetupCustomization.sharedInstance()
    custom!.brandName = "Some Brand"
    custom!.allowPasswordManager = true
    custom!.brandImage = nil //brandImage
    //custom!.productImage = UIImage(named: "my app icon product image")
    //custom!.pageBackgroundImage = UIImage(named: "checkered flag")
    custom!.linkTextColor = UIColor.white
    //custom?.normalTextFontName = "Gotham-Medium"
    //custom?.boldTextFontName = "Gotham-Medium"
    //custom?.headerTextFontName = "Verdana"
    custom!.lightStatusAndNavBar = true
    custom!.tintSetupImages = true
    custom!.normalTextColor = UIColor.white
    custom!.brandImageBackgroundColor = UIColor(red: 0.1, green: 0.1, blue: 0.1, alpha: 0.25)
    custom!.elementTextColor = UIColor.black//(red: 0.098, green: 0.859, blue: 0.435, alpha: 1.0)
    custom!.elementBackgroundColor = .red
    custom!.modeButtonName = "Reset"
    custom!.productMode = true
    custom!.productName = "Some App"
    custom!.productId = 0000
    let keys = xxxxx()
    ParticleCloud.sharedInstance().oAuthClientId = keys.oAuthClientId
    ParticleCloud.sharedInstance().oAuthClientSecret = keys.oAuthSecret


2017-12-06 16:41:06.606189-0800 [1350:369413] *** Assertion failure in -[KeychainItemWrapper writeToKeychain], /Users/s /Pods/Particle-SDK/Pod/Classes/Helpers/KeychainItemWrapper.m:328
2017-12-06 16:41:06.607290-0800 [1350:369413] *** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘Couldn’t add the Keychain Item.’
*** First throw call stack:
(0x18397e364 0x182bc4528 0x18397e238 0x1843197f4 0x1055a04f0 0x10559f934 0x1055b4bf0 0x1055b44f4 0x1055a24cc 0x104fcb3f8 0x104fed8a0 0x1063b12cc 0x1063b128c 0x1063b5c20 0x183926544 0x183924120 0x183843e58 0x1856f0f84 0x18cec367c 0x1046c4fa0 0x18336056c)
libc++abi.dylib: terminating with uncaught exception of type NSException

Keychain Sharing is on


Try this:


Please see the bottom of my post where it says that Keychain Sharing is already ON, and this issue is still occurring. It does not cause any issues in the simulator, only on my iPhone 7.

Any ideas??? Why would it not be able to add the Keychain item, when I have Keychain Sharing on??? Any chance you can fix whatever is causing this in the SDK with the new pod ‘ParticleSetup’, as this issue was not there with pod ‘SparkSetup’. It might also be worth investigating to see if Apple has made any Keychain Sharing changes in the newest version of XCode 9.2 or iOS 11.2.1. I am not sure if there would be any issues with switching back to the pod SparkSetup and removing the Particle Setup Pod, besides unupdating the delegate name and functions, while keeping the newer pod ‘Particle-SDK’ in the project for now, until you guys sort this. I can always go back to a a previous saved version, but I have also been actively working on this project. Thank you!!!

This may have to do with what is causing the error, but I am not sure.



Sorry for a very late reply.
I’ve completely rehauled the iOS example app to use all the latest ParticleSetup/SDK (renamed) pods with XCode 9, Swift 4 and all the latest tooling. I’ve highlighted the procedure to get a basic app to work in the readme in the repo. There’s no need to touch any of the default keychain settings anymore, it works well both on simulator and device out of the box.

Give it a spin, see if you still have any issues: