15

In iOS 10 and xcode 8 when I try to sign in to google services I get "keychain error"

 func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!){
        if error != nil {
            print("\(error!.localizedDescription)")
}
}

Offered and accepted solutions on SO are to run the app direct from simulator and not via Xcode. This I have tried and have had no success hence posting this question here in the hope someone has a more recent solution or experience.

RyanTCB
  • 7,400
  • 5
  • 42
  • 62

1 Answers1

45

The problem you are trying to solve is connected with keychain access. To fix issue you simply should go to Target->Capabilities and enable keychain sharing. Similar case with Facebook SDK is desribed here.

If you are using Xamarin (read this link for more information, thanks @dynamokaj):

Just make sure you enable the keychain access in Entitlements and select the entitlements for Simulator (Debug) builds too. By default this is not set.

Community
  • 1
  • 1
Roman Ermolov
  • 7,898
  • 5
  • 27
  • 35
  • if we enable keychain sharing,Can other apps see our keychain stored keys? – Husein Behboudi Rad Sep 11 '16 at 11:26
  • @HuseinBehboodiRad only apps with same app id prefix will be able to use stored keys if you will enable keychain sharing. App id prefix is your team id, so only your apps will see this stored keys. – Roman Ermolov Sep 11 '16 at 11:39
  • if some one hardcode my appId prefix in their access group then they can not see the keys too? – Husein Behboudi Rad Sep 11 '16 at 11:40
  • 1
    @HuseinBehboodiRad Hardcoding app prefix id is impossible (because it is connected to your developer Apple ID). Please check `Keychain Sharing` in [documentation](https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/AddingCapabilities/AddingCapabilities.html). – Roman Ermolov Sep 11 '16 at 11:46
  • I turned keychain sharing to On, it is now working on emulator but not working on real device with iOS 10 GM-seed – Husein Behboudi Rad Sep 11 '16 at 13:40