When I try to add the item to Keychain i found this crash on iOS10 *** Assertion failure in -[KeychainItemWrapper writeToKeychain]
On iOS 9.3 I write the key in the keychain without problem Thanks
It looks like a bug; a bug report has been filed, but there's a workaround. Just enable "Keychain Sharing" (under your app -> Capabilities tab in Xcode). See https://forums.developer.apple.com/thread/51071 for full background.
Edit: Ignore what I was rambling about... duh, forgot that under the project target's Capabilities tab I have also enabled Keychain sharing... Though still would like to get a deeper, more cogent answer.
So guess you can ignore this... but leaving here just in case you run into the privacy stuff (though that's another SO question which I'm sured has been answered elsewhere):
Yeah, I had the same problem (also with asking for location crashing)... looks like a change in iOS 10 regarding privacy and services. Strangely in my case adding the keys below this comment to the info.plist (or via Xcode you'll see them with "Privacy-*")
Funny thing is that suddenly keychain access worked just fine, even though none of these keys have anything to do with keychain access... I'm still digging more into that so I can provide a "real answer", but hopefully this can unblock you for now.
Here's what I added (note don't think you need all of them, but just to ensure my answer matches what I did):
<key>LSApplicationCategoryType</key>
<string></string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>health devices</string>
<key>NSRemindersUsageDescription</key>
<string>medication reminders</string>
<key>NSMicrophoneUsageDescription</key>
<string>calls</string>
<key>NSCameraUsageDescription</key>
<string>Allow Moonshot to use the camera (profile and calls)</string>
<key>NSMotionUsageDescription</key>
<string>Allow Moonshot to use motion to track activity</string>
<key>NSLocationUsageDescription</key>
<string>Allow Moonshot to use location to track activity</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Allow Moonshot to always use location (to track activity)</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Allow Moonshot to use location while in use (to track activity)</string>
<key>CFBundleDevelopmentRegion</key>
来源:https://stackoverflow.com/questions/39561041/keychainitemwrapper-crash-on-ios10