Error in facebook login, IOS 9, Swift

前端 未结 3 1376
没有蜡笔的小新
没有蜡笔的小新 2021-01-26 23:45

I\'m trying to implement facebook login in my app. But getting an error. My info.plist code is :

   

LSAppli         


        
相关标签:
3条回答
  • 2021-01-27 00:32

    This error message appears only when you are using simulator, not when you use a device.

    Since your info.plist is ok, you can ignore it.

    Check this answer: iOS 9 Facebook login simulator -canOpenURL: failed for URL: "fbauth2:///" - error: "(null)"

    0 讨论(0)
  • 2021-01-27 00:34

    Answer: You can ignore the message...

    @Jonathan Hornby @joan16v: I had the same issue but placing the code in an action button (not in the viewDidLoad method) worked for me.

    BTW: You don't need a bridging header anymore.

    0 讨论(0)
  • 2021-01-27 00:35

    I came to the same conclusion, but had other issues on the path to this error message which may be helpful for others - so sharing here.

    I used Parse v1.9.0 with the FBSDK v4.7 & Xcode 7.0.1. I was following Rob Percivals iOS9 & Swift 2 course on udemy.com. (lecture 131).

    He had used earlier versions of the sdks - his zipped up code worked, but I got the fbauth2 errors. When I tried to use the latest sdks, I couldn't even get as far as the errors.

    The Parse v1.9.0 downloads have a file missing: ParseStarterProject-Bridging-Header.h - without it, none of the import statements work.

    The Parse AppDelegate tells you to follow Facebooks instructions for setting everything up on the FB site & populating your info.plist file, then uncomment a line in the missing header file.

    I created a ParseStarterProject-Bridging-Header.h from scratch & put the import statements in for PFFacebookUtilsV4/PFFacebookUtils.h & FBSDKCoreKit/FBSDKCoreKit.h.

    Also note that when you unpack the Parse v1.9.0 starter project, it doesn't contain all the frameworks, so make sure you unpack the Parse Library zip and then drag into your project. Ditto for Facebook.

    At this point, I thought everything would work - it didn’t. Still lots of red error messages. When I looked at the “issues navigator” it couldn’t find the FBSDK, ParseFacebookUtilsV4 or the header file I’d created. They were all in the navigation pane, so I was totally confused.

    The key/solution was in the Targets Build Settings.

    Under Search Paths: Always Search User Paths - I set this to YES - default was NO.

    Framework Search Paths - You should have a pointer to your project, but need to add one to your FBSDK location. It should be /Users//Documents/FacebookSDK if you followed the recommendations.

    Swift Compiler - Code Generation:

    Install Objective-C Compatibility Header = YES
    
    Objective-C Bridging Header = ParseStarterProject/ParseStarterProject-Bridging-Header.h
    

    Took me a while to get the right syntax here - if you used the ParseStarterProject and put the header file in the same group as your AppDelegate and ViewController - the above should work for you.

    The default PFFacebookUtils.initializeFacebook() line provided by parse for uncommenting didn’t work for me - kept showing an error, so I replaced with a variant of the test code provided by Facebook. Worked like a charm - still got the fbauth2 errors, but now got to the fb login screen & connected. That's when I discovered the fbauth2 error messages didn't have a negative effect - you can ignore them :)

    If you have been struggling with Parse & FB integration - hope this helped!

    0 讨论(0)
提交回复
热议问题