After digging a lot I am here posting my problem. I am using google sign in latest sdk in my app and the app supports iOS 8+. I am using Xcode 7.2 currently. Recently my app got rejected with the very common reason which many users have experienced in the past:
FROM APPSTORE
We noticed that the user is taken to Safari to sign in or register for an account, which provides a poor user experience. Specifically, Google log in takes users to Safari to sign in.
Next Steps
10.6 Please revise your app to enable users to sign in or register an account in the app.
We recommend implementing the Safari View Controller API to display web content within your app. The Safari View Controller allows the display of a URL and inspection of the certificate from an embedded browser in an app so that customers can verify the webpage URL and SSL certificate to confirm they are entering their sign in credentials into a legitimate page.
END
I already know this rejection as apple has rejected lot of apps which are taking the Sign In flow out in the Safari browser. Here are some of the links for reference
https://code.google.com/p/google-plus-platform/issues/detail?id=900
https://github.com/Torsten2217/google-plus-platform/issues/900
and some more links you can easily find on Internet
On May 2015 Google released a new sdk with native web view. The complete process of integration is listed here http://www.appcoda.com/google-sign-in-how-to/.
It was working fine with iOS 8 and was presenting a controller too.
Now I was using the latest google sdk which I installed via CocoaPods
https://developers.google.com/identity/sign-in/ios/start
The above link from google has a Try Sign-In for iOS sample which I tried. It is now opening a native SFSafariViewController
in iOS 9 only but in iOS 8 the login flow is again going outside the app to Safari browser.
In the comments apple reviewer asked to use SafariViewController
but the availability of the control is from iOS 9 and above.Here is the link https://developer.apple.com/library/ios/documentation/SafariServices/Reference/SFSafariViewController_Ref/
How can I achieve this with latest google sdk in iOS 8.
The reviewer has neither mentioned the iOS version he/she was testing.
Now can anyone help me in sorting this out. How can I manage in iOS 8, the native present controller for Google Login page.
Finally the problem is sorted out with latest Google+ Sign SDK and the app is also approved by Apple. I am posting a solution for both iOS 9 and iOS 8.
Use CocoaPods for integration.
To start with login you have to do exactly the same steps mentioned in the Start Integrating Section here
Now in the Add Sign-In part, I want some custom button in my custom class of
UIViewController
to initiate the login process. In the developer link of Google, they are redirecting in AppDelegate only. So to avoid this I will not be usingGIDSignInDelegate
in myAppDelegate
classI will only be making changes in the following two methods of
AppDelegate
So the definitions will be as follows:
Now moving on to our Custom
UIViewController
class i.eLoginViewController
, implement theGIDSignInDelegate
andGIDSignInUIDelegate
There is a custom UIButton for Google + login whose definition is
Now the implementation of delegate methods for Google + Sign In
Now this will work in both iOS 8 and 9 without moving your app outside to Safari for Login purpose in Google +.