No known class method (facebook sdk integration) - ios

I'm trying to add the react-native-fbsdk-next into my react-native app. The documentation says to add the following lines to the AppDelegate.m file to enable AEM (Aggregated Event Measurement)
#import <FBAEMKit/FBAEMKit.h>
[FBAEMReporter configureWithNetworker:nil appID:{app-id}];
[FBAEMReporter enable];
[FBAEMReporter handleURL:url]
After I added these lines of code like this:
(BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
[FBAEMReporter configureWithNetworker:nil appID:123456789]; // in the code I use the real app Id
[FBAEMReporter enable];
[FBAEMReporter handleURL:url];
#if defined(EX_DEV_LAUNCHER_ENABLED)
if ([EXDevLauncherController.sharedInstance onDeepLink:url options:options]) {
return true;
}
#endif
return [super application:application openURL:url options:options] || [RCTLinkingManager application:application openURL:url options:options];
}
the build fails with the following error no known class method for selector 'configureWithNetworker:appID:'. I can't find or understand how to fix this issue, the documentation doesn't provide any additional information/steps to follow. Any advise or help is greatly appreciated.

It looks like a mistake in the react-native-fbsdk-next README
the underlying method signature in the native Facebook iOS SDK is:
+ (void)configureWithNetworker:(nullable id<FBAEMNetworking>)networker
appID:(nullable NSString *)appID
reporter:(nullable id<FBSKAdNetworkReporting>)reporter;
So the call should be:
[FBAEMReporter configureWithNetworker:nil appID:#"1234556" reporter:nil];
[FBAEMReporter enable];
[FBAEMReporter handleURL:url];
(note that appID is a string, also I am unfamiliar with the SKAdNetworkReporter but it is nullable so it builds passing in nil).

Related

React native fbsdk login IOS white screen

i am having problem using official react-native-fbsdk package for facebook login, it works well in android but in IOS after the login finished or cancelling it redirects to blank page instead of going back to my app.
What I have done :
Linked react-native-fbsdk
Followed IOS getting started guide in facebook page
any help will be appreciated.
You need to modify your AppDelegate.m file in ios project
Facebook react-native faq
This problem indicates that the code in the AppDelegate.m file hasn't been setup properly. Confirm that your code is similar to this example:
AppDelegate.m
#import <FBSDKCoreKit/FBSDKCoreKit.h>
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];
// Add any custom logic here.
return YES;
}
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
BOOL handled = [[FBSDKApplicationDelegate sharedInstance]
application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation
];
// Add any custom logic here.
return handled;
}

Facebook apps using react native. Can't find ViewController.m

I'm creating an app using react native and xcode. I've been following the set up instructions on facebook because I'm going to implement their login. However it says to add some code into ViewController.m in your xcode project, but when I initialize a new react project in terminal, it doesn't create one. I also can't find the ViewDidLoad method. Any suggestions?
In one of your app's ViewController.m files, and also in the AppDelegate.m file add:
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
In the ViewController.m file, add the following code to the viewDidLoad method:
FBSDKLoginButton *loginButton = [[FBSDKLoginButton alloc] init];
loginButton.center = self.view.center;
[self.view addSubview:loginButton];
Add this method in your app's AppDelegate.m file:
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
return [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation];
}
Solved. React Native doesn't create ViewController files. If you are using React Native and the facebook app guide, disregard the 'Let's test out your integration' steps.

FBAppCall removed from Facebook update 4.x - return to app after Facebook login

Since the update to Facebook 4.x, the following no longer works:
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
return [FBAppCall handleOpenURL:url sourceApplication:#"yyyyxxxxyyyxxxx" withSession:[PFFacebookUtils session]];
}
as both application: handleOpenURL has been deprecated, and FBAppCall has been removed to be replaced with BFURL.
I've tried reading the Bolts documentation which suggests the following:
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
BFURL *parsedUrl = [BFURL URLWithInboundURL:url sourceApplication:sourceApplication];
//do something with parsedUrl if neccessary
...but then I'm not sure what to do with the BFURL. Previously, this method just contained:
return [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation];
}
but now every time I try to login to FB (w/o the FB app installed), it exits to Safari, approves the app, returns to my app, but reboots it, and fails to log in. After about 4 successive tries, it sometimes logs in. I presume this is because I'm not correctly handling the return to the app, but not sure what to add.
Replace the old return with this:
return [[FBSDKApplicationDelegate sharedInstance] application:app openURL:url sourceApplication:options[UIApplicationLaunchOptionsSourceApplicationKey] annotation:options[UIApplicationLaunchOptionsAnnotationKey]];
If you're using the FBSDKLoginManager, then for the loginInWith*Permissions methods, you can specify a handler as well. The handler is the callback for when your app gets started again (put whatever logic you used to have in FBAppCall's callback for login in this handler).
Then, connect your app delegate class to the FBSDKApplicationDelegate as described in the Getting Started guide. That will tell the SDK to call your handler.
Read more about login on iOS here.

Facebook delegates are not calling after authentication: cocos2d

He guys, I am doing a photo share in my cocos2d application with Facebook SDK. I've a problem that: the login view with status Not Logged In is remaining even after authentication. I'm attaching the images:
Problem: After clicking the Skip or OK button of the Authentication page, the status has to be changed as Login. But it isn't. No Facebook delegates are getting called after Auth(When I enter the page first time, loginViewShowingLoggedOutUser delegate was get called. After auth, nothing is get called.).
What I've done already:
Downloaded the Facebook SDK, attached to the project.
Added FacebookAppID,FacebookDisplayName and URL Schemes in info.plist.
Tried the integration with my cocos2d app.
Added <FBLoginViewDelegate> in .h.
Added loginview.delegate = self in .m.
I'm also uploading the screenshot of what I've done in my info.plist:
I am creating the login view as:
// Create Login View so that the app will be granted "status_update" permission.
FBLoginView *loginview = [[FBLoginView alloc] init];
loginview.frame = CGRectOffset(loginview.frame, 5, 5);
#ifdef __IPHONE_7_0
#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_7_0
if ([self respondsToSelector:#selector(setEdgesForExtendedLayout:)]) {
loginview.frame = CGRectOffset(loginview.frame, 5, 25);
}
#endif
#endif
#endif
loginview.delegate = self;
[[[CCDirector sharedDirector]view]addSubview:loginview];
[loginview sizeToFit];
What I found:
The following method in appdelegate is not get called:
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
// attempt to extract a token from the url
return [FBAppCall handleOpenURL:url
sourceApplication:sourceApplication
fallbackHandler:^(FBAppCall *call) {
NSLog(#"In fallback handler");
}];
}
Further info:
Xcode Version 5.0.1
iOS Version 7.0
facebook-ios-sdk-3.9
Any help ASAP is appreciable.
Thanks.
Sorry guys.... #elio.d: and thank you very much for your valuable suggestion . That was my mistake with coding. I have pasted the following method, just above #implementation AppController. What an idiot I am. This just wasted one of my whole day... :
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
}
This just saved me. Hope this might be helpful for some others like me. :)
You have to add an url scheme in your app to make the facebook app / website call your app back after login or authorization link to the documentation, this is the reason why your app is not called

application:openURL:sourceApplication:annotation: not called in app delegate

I'm using the application:openURL:sourceApplication:annotation: to open a file with an extension .ftl. This is declared in my app's info property list.
The .ftl file is attached to an email, and when touched calls an ALREADY LAUNCHED app. The code works fine in IOS 4, but in IOS 6 the above app delegate method isn't called.
The code is in my app delegate is simply:
-(BOOL) application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
NSLog(#"method is called");
if (url != nil && [url isFileURL]) {
[self performSelector:#selector(splashFade) withObject:nil];
NSLog(#"inside if statement called");
//Calls singleton to delete existing data, parse and ingest supplied new file data into Coredata:
[[ContentController sharedInstance] deleteSectorList:(NSURL *)url];
}
return YES;
}
Does anyone have any idea why this method is no longer called?
Thanks.
You have to tell the phone that your app accepts certain files. You do this by going to the info.pList and there you add a flag.
Follow this link which will cover this subject. https://developer.apple.com/library/ios/#documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/RegisteringtheFileTypesYourAppSupports.html%23//apple_ref/doc/uid/TP40010411-SW1

Resources