0

I can't make my app to login to facebook after i updated to IOS 9.

I'm using Facebook-iOS-SDK (4.0.1). I followed the steps from https://developers.facebook.com/docs/ios/ios9

Here is what i get:

2016-02-08 22:30:12.962 Test[46890:887841] -canOpenURL: failed for URL: "fbauth://authorize/?auth_type=rerequest&client_id=1567056303561905&default_audience=friends&display=touch&e2e=%7B%22init%22%3A1454963412954%7D&redirect_uri=fbconnect%3A%2F%2Fsuccess&response_type=token%2Csigned_request&return_scopes=true&scope=email&sdk=ios&sdk_version=4.0.1&state=%7B%22com.facebook.sdk_client_state%22%3Atrue%2C%223_method%22%3A0%2C%220_auth_logger_id%22%3A%22726D5E62-ED16-43E4-A946-1266F17C8CA4%22%7D" - error: "(null)" 2016-02-08 22:30:20.954 Test[46890:888120] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.

Any thoughts?How do i fix that?

UPDATE:

<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
    <key>facebook.com</key>
    <dict>
        <key>NSIncludesSubdomains</key><true/>                
        <key>NSThirdPartyExceptionRequiresForwardSecrecy</key><false/>
        <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key> <true/>
    </dict>
    <key>fbcdn.net</key>
    <dict>
        <key>NSIncludesSubdomains</key>
        <true/>
        <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
        <false/>
    </dict>
    <key>akamaihd.net</key>
    <dict>
        <key>NSIncludesSubdomains</key>
        <true/>
        <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
        <false/>
    </dict>
</dict>
</dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fbapi20130214</string>
<string>fbapi20130410</string>
<string>fbapi20130702</string>
<string>fbapi20131010</string>
<string>fbapi20131219</string>    
<string>fbapi20140410</string>
<string>fbapi20140116</string>
<string>fbapi20150313</string>
<string>fbapi20150629</string>
<string>fbauth</string>
<string>fbauth2</string>
<string>fb-messenger-api20140430</string>

Thanks.

user358448
  • 1,127
  • 3
  • 20
  • 39
  • have you check this http://stackoverflow.com/questions/33513630/how-to-get-email-id-of-user-using-facebook-sdk-4-7-in-ios-9/33513692#33513692 – kb920 Feb 09 '16 at 06:10
  • Possible duplicate of [graph.facebook.com - Transport security block](https://stackoverflow.com/questions/33554104/graph-facebook-com-transport-security-block) – nathan Sep 13 '17 at 02:37

1 Answers1

0

notice the App Transport Security - now you have to connect via https (and not http)

if you want you can edit it in the plist and allow specific urls with http and not https, but this is not recommended

Witterquick
  • 6,048
  • 3
  • 26
  • 50
  • how/where do i change to https? – user358448 Feb 08 '16 at 21:29
  • add this to your plist NSAppTransportSecurity NSExceptionDomains www.facebook.com NSIncludesSubdomains NSTemporaryExceptionAllowsInsecureHTTPLoads – Witterquick Feb 08 '16 at 21:38
  • or, check this thread - http://stackoverflow.com/questions/30731785/how-do-i-load-an-http-url-with-app-transport-security-enabled-in-ios-9 – Witterquick Feb 08 '16 at 21:40
  • I've added that, still nothing. Is this facebook http access related, cos there is other http calls in the app, but i get that error during fb login. Updated, my post above with the plist. – user358448 Feb 08 '16 at 21:53
  • just for the check - you can allow all calls to http instead of https. This way you will see if this is what causing your problem. So add to the plist: NSAppTransportSecurity NSAllowsArbitraryLoads (and delete for now your current NSAppTransportSecurity dictionary from there) – Witterquick Feb 08 '16 at 22:02