Facebook request stops working after update ios9 and update to CoronaSDK 2015.2731

I had my app working perfectly with ios8. I updated to the new  CoronaSDK 2015.273, updated my XCode and recompiled my app for ios9. Suddenly I am able to login using facebook but facebook request is not working.

Oct 13 07:24:40  regiowars[89343]: event.name:fbconnect
Oct 13 07:24:40  regiowars[89343]: isError: true
Oct 13 07:24:40  regiowars[89343]: didComplete: nil
Oct 13 07:24:40  regiowars[89343]: event.type:request

If I check the facebook response I get : Oct 13 07:24:40  regiowars[89343]: The operation couldn’t be completed. (com.facebook.sdk error 5.)

Whereas in the login I can see :

Oct 13 07:24:18 Stark regiowars[89343]: event.name:fbconnect
Oct 13 07:24:18 Stark regiowars[89343]: isError: false
Oct 13 07:24:18 Stark regiowars[89343]: didComplete: nil
Oct 13 07:24:18 Stark regiowars[89343]: event.type:session

So login pretty much works. I also erased the app and installed it again so I could see the facebook page for login.

My code is pretty much the one in the corona example:

I have a login and a listener:

        local function listener( event )             print( "event.name:" .. event.name )  --"fbconnect"             print( "isError: " .. tostring( event.isError ) )             print( "didComplete: " .. tostring( event.didComplete ) )             print( "event.type:" .. event.type )  --"session", "request", or "dialog"             --"session" events cover various login/logout events             --"request" events handle calls to various Graph API calls             --"dialog" events are standard popup boxes that can be displayed             print(event.response)             if ( "session" == event.type ) then                 --options are "login", "loginFailed", "loginCancelled", or "logout"                 if ( "login" == event.phase ) then                     access\_token = event.token                     facebookrequest()                 end                     --code for tasks following a successful login                 if ( event.phase == "ended" ) then                 end                                  elseif ( "request" == event.type ) then                 if ( not event.isError ) then                   fbresponse = json.decode( event.response )                   requestchecker(fbresponse)                 end             end         end facebook.login( FBAppID, listener, { "user\_friends" } )

I have a button for requesting facebook friends:

        local function tochallenge( event)             if ( "ended" == event.phase ) then               local options =               {                  isModal = true,               }                composer.showOverlay( "spinner",options )                facebook.request( "me/friends", "GET")             end         end

And pressing this one is when I get this error from facebook (after login).

I really dont know how to solve this one.
 

 

I haven’t tested it yet. But I am pretty sure I found the issue. It has to do with IOS9 and APP transport security:

https://coronalabs.com/blog/2015/09/17/about-app-transport-security-ats/

https://developers.facebook.com/docs/ios/ios9

I will test it later today, but I am pretty sure is this

You have to switch to the new Facebook V4 plugin if you want to run on iOS 9. Please see the sample app included with build 2731 on the changes to build.settings and the facebook access code.

Rob

I made the change that is explained here:

https://coronalabs.com/blog/2015/09/17/about-app-transport-security-ats/

and it worked.

Why should I move to facebook v4, corona documentation states that it is still in beta phase.

I’m not sure the exact reason, but you need the latest Facebook SDK (which we provide via the plugin) if you want to use the iOS 9 SDK to build with. It very likely could have something to do with the ATS security changes.

We are working on getting it out of Beta.

I haven’t tested it yet. But I am pretty sure I found the issue. It has to do with IOS9 and APP transport security:

https://coronalabs.com/blog/2015/09/17/about-app-transport-security-ats/

https://developers.facebook.com/docs/ios/ios9

I will test it later today, but I am pretty sure is this

You have to switch to the new Facebook V4 plugin if you want to run on iOS 9. Please see the sample app included with build 2731 on the changes to build.settings and the facebook access code.

Rob

I made the change that is explained here:

https://coronalabs.com/blog/2015/09/17/about-app-transport-security-ats/

and it worked.

Why should I move to facebook v4, corona documentation states that it is still in beta phase.

I’m not sure the exact reason, but you need the latest Facebook SDK (which we provide via the plugin) if you want to use the iOS 9 SDK to build with. It very likely could have something to do with the ATS security changes.

We are working on getting it out of Beta.