0

I am trying to work ParseFacebookUtilsv4 & FacebookSDK v4.. After many trials, I've managed to reduce the errors to 1.

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

    Parse.setApplicationId("###",
        clientKey: "###")

    PFFacebookUtils.initializeFacebookWithLaunchOptions(launchOptions)

}

In this part, which is exactly copied from Parse's iOS Docs - Facebook Setup (that is updated yesterday for FBSDKv4), I am getting an error:

'PFFacebookUtils.Type' does not have a member named 'initializeFacebookWithLaunchOptions'

When I check the full documentation of ParseFacebookUtilsv4 which says ~ Warning: This class supports official Facebook iOS SDK v4.0+ and is available only on iOS. ~, I saw that there isn't any class called 'initializeFacebookWithLaunchOptions'; instead there is 'initializeFacebookWithApplicationLaunchOptions:'

However, when I change my AppDelegate.swift / didFinishLaunchingWithOptions part as:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

    Parse.setApplicationId("###",
        clientKey: "###")

    PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions)

}

...I get an error saying 'Missing return in a function expected to return 'Bool'. Then I tried to add both

 return true /* AND */ return false // at the end of the function; 

...I get 9 crashes such as: i.stack.imgur.com/o989R.png

I am completely stuck and don't know how to fix this.

senty
  • 12,385
  • 28
  • 130
  • 260
  • Have you provided Facebook application ID in bundle plist? – Uttam Sinha Apr 11 '15 at 05:25
  • @Uttam Yes, I did. It is definitely this line creating the problem... `PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions)` ...because when I comment it out and `return true`; app starts without any errors. – senty Apr 11 '15 at 05:52
  • Can we please see the full error log? – Schemetrical Apr 11 '15 at 06:37
  • [Here is the full error log](https://lh3.googleusercontent.com/-jIkpt5M9KdA/VSirP8Pfk5I/AAAAAAAAAEk/pJowDxJx_jA/s1600/Screen%2BShot%2B2015-04-11%2Bat%2B08.02.39.png) when I `PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions)` and `return true` – senty Apr 11 '15 at 06:53
  • Refer this link - http://stackoverflow.com/questions/15457136/parse-for-ios-errors-when-trying-to-run-the-app Hope the solution provided here will work for you :) – Uttam Sinha Apr 11 '15 at 07:14
  • Unfortunately, i couldn't manage to sort out by using these methods :/ http://imgur.com/4Mo53vC ; Here you can see that I have added FacebookSDKv4, Parse iOS 1.7.1 and its all necessary bits on my Project. I also don't have anything in my 'Other Linker Flags': http://imgur.com/u9bbf14 ... Am I doing something wrong or..? – senty Apr 11 '15 at 19:49

8 Answers8

6
[PFFacebookUtils initializeFacebookWithApplicationLaunchOptions:launchOptions]; //works

[PFFacebookUtils initializeFacebookWithLaunchOptions:launchOptions]; //does not compile or work

The first line above worked for me. Seems like they have forgotten to update their documentation.

Rob
  • 530
  • 1
  • 5
  • 8
1

you should go to your PFFacebookUtils.h in the PFFacebookUtils.h header file and change:

(void)initializeFacebookWithApplicationLaunchOptions:(NSDictionary *)launchOptions;

To:

(void)initializeFacebookWithApplicationLaunchOptions:(PF_NULLABLE NSDictionary *)launchOptions;

it will work ! references https://developers.facebook.com/bugs/1462780714012820/

kader kabore
  • 345
  • 4
  • 16
0

Based on your error logs, I think either you're missing dependencies, or you have dependencies added here but you haven't included them in your project.

I think your Facebook SDK isn't included in the build target, since the symbols that are missing have FB prefixes.

Schemetrical
  • 5,506
  • 2
  • 26
  • 43
  • http://imgur.com/4Mo53vC As you can see I have added both FacebookSDK(v4) and Parse 1.7.1 (so PFFacebookUtilsv4) on my project. And the error I am getting is not from Facebook SDK; rather it's PFFacebookUtils which is related with Parse, not Facebook. – senty Apr 11 '15 at 19:54
0

Found my answer: I had to import FBSDKLoginKit in my bridging header (which was not mentioned in the recently updated Parse Doc).

So my bridging-header looks like:

    #import <FBSDKCoreKit/FBSDKCoreKit.h>
    #import <FBSDKLoginKit/FBSDKLoginKit.h>
    #import <ParseFacebookUtilsV4/PFFacebookUtils.h>
    #import <Parse/Parse.h>
    #import <Bolts/Bolts.h>
senty
  • 12,385
  • 28
  • 130
  • 260
0

I was having the same issue and had to implement two of the suggestions above to get my app to run with out issue.

First i added the FBSDKLoginKit from the FB SDK and imported it.(Thanks senty)

#import <FBSDKLoginKit/FBSDKLoginKit.h>

Then i replaced:

[PFFacebookUtils initializeFacebookWithLaunchOptions:launchOptions];

with:

[PFFacebookUtils initializeFacebookWithApplicationLaunchOptions:launchOptions];

Hope my answer is helpful.

joffd
  • 521
  • 5
  • 19
0

I had had the same problem with FB SDK v4 + Parse v1.7.5 SDK.

Finally, I solved this problem on my project. There is a mistake from the Parse blank project. Don't use Parse blank project.

https://www.parse.com/docs/downloads/ It is the official download page and there are two types download(v 1.7.5), which is SDK or Blank Project, to start project.

It is only working with Parse SDK files + your new project! Please import just only SDK.

Hwan
  • 13
  • 3
0

Try to remove the ParseFacebookUtils(just keep the ParseFacebookUtilsV4) it create some conflicts.

William Ode
  • 188
  • 3
  • 11
0

If you are using FB SDK v4 + Parse v1.7.5 SDK,

I only have:

#import <ParseFacebookUtilsV4/PFFacebookUtils.h>

in my bridging header. My AppDelegate.swift file now contains:

import Parse
import Bolts
import FBSDKCoreKit
import FBSDKShareKit
import FBSDKLoginKit

and I'm able to run my app successfully.

tzhenghao
  • 128
  • 2
  • 5