IOS crash for iOS

I am trying to set up facebook SDK 3.5 for iOS. I got it to work fine, but now it is crashing. The failure only seems to occur when the user logs in via the default iOS facebook settings (AKA is not a facebook application from the app store). The application crashes when viewing the "login" to facebook.

Crash: error: [NSError fberrorShouldNotifyUser]: unrecognized selector sent to the instance.

I did some Research , and some people suggest putting -Objc in "other linker flags." I don't have it for sure, but I have something similar, I think. I need other options for other libraries. Here are my options:

enter image description here

Can someone tell me if this caused a problem? If not, does anyone know what really causes a crash? Thanks!

EDIT

It would seem that an error has occurred in this method from the very first “if”

- (void)loginView:(FBLoginView *)loginView handleError:(NSError *)error { NSString *alertMessage, *alertTitle; if (error.fberrorShouldNotifyUser) // CRASH HERE { // If the SDK has a message for the user, surface it. This conveniently // handles cases like password change or iOS6 app slider state. alertTitle = @"Facebook Error"; alertMessage = error.fberrorUserMessage; } else if (error.fberrorCategory == FBErrorCategoryAuthenticationReopenSession) { // It is important to handle session closures since they can happen // outside of the app. You can inspect the error for more context // but this sample generically notifies the user. alertTitle = @"Session Error"; alertMessage = @"Your current session is no longer valid. Please log in again."; } else { // For simplicity, this sample treats other errors blindly. alertTitle = @"Unknown Error"; alertMessage = @"Error. Please try again later."; NSLog(@"Unexpected error:%@", error); } } 
+4
source share
3 answers

I had the same problem. According to this

https://developers.facebook.com/docs/ios/errors/#prerequisites

you need to set -ObjC flag or use FBErrorUtility instead of fberror*

I just added the -ObjC flag and it worked fine.

+2
source

If you are already using a project using ARC, you do not need to add this linker flag.

Make sure the NSError+FBError.h file is imported in your code, where it extracts this category from.

Technically, if you import <FacebookSDK/FacebookSDK.h> , this category definition is included.

In addition, if your code cannot find this header file, make sure that FacebookSDK.Framework included in the list of related frameworks and libraries on the resume landing page.

+1
source

When the device returns to your application from the Facebook login, your application should be running in the background. I fixed this error by turning on "quick switch applications." Its setting under the tab "Target data" is called "The application does not work in the background." It should be NO.

0
source

Source: https://habr.com/ru/post/1481574/


All Articles