简体   繁体   中英

Login error in iOS 9 Facebook SDK

I've seen many questions on StackOverflow about this problem, but none solved my issue.

I've created a sample app containing only the FB login button, followed the Facebook iOS 9 setup documentation, inserted ATS configs in info.plist and tried to run.

Everything works on iOS Simulator (I'm running XCode 7.1) except for a warning, but i wasn't very concerned because Facebook docs days it can be ignored.

This is the warning tho

-canOpenURL: failed for URL: "fbauth2:/" - error: "(null)"

Login works fine, and returns to the MainViewController logged in.

Problem occurs when i try to run it on device (iPhone 5, iOS 9.0.2)... View switches to safari but after loggin in and confirming permissions, Safari fails to redirect back to the app, and says the address is invalid.

What is wrong with my application? Is there something i didn't consider? Thanks in advance.

IOS 9 URL Shchemes Update : iOS 9 introduces LSApplicationQueriesSchemes to allow apps to query if other apps are installed.

1- If a url scheme is declared and calling canOpenURL(scheme)

YES if a installed app supports that URL scheme

NO if no app supporting that url

syslog will show canOpenURL: failed for URL: "urlScheme://" - error: null

2- If a url scheme is not declared and calling canOpenURL(scheme)

always return NO

syslog will show canOpenURL: failed for URL: "urlScheme://" - error: null

In iOS 9, the developer must add these info.plist LSApplicationQueriesSchemes

    <array>
    <string>urlscheme</string>
    <string>urlscheme2</string>
    <string>urlscheme3</string>
    <string>urlscheme4</string>
    </array>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM