Skip to content

Crash on FBSDKAppLinkNavigation #1596

@Kry256

Description

@Kry256

Checklist

Environment

Xcode Version: 12.2
Swift Version: 5.3
Installation Platform & Verison: Swift Package
The crash happens on all Facebook iOS 8.x.x SDK versions.

Steps to Reproduce

I'm facing into a crash when invoking
+ (void)resolveAppLink:(NSURL *)destination handler:(FBSDKAppLinkBlock)handler
of FBSDKAppLinkNavigation class

I use it inside
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray<id<UIUserActivityRestoring>> * __nullable restorableObjects))restorationHandler
of my app delegate class in this way
[FBSDKAppLinkNavigation resolveAppLink:userActivity.webpageURL
handler:^(FBSDKAppLink * _Nullable appLink, NSError * _Nullable error) {

Every time the method is invoked, it makes the app crash, below the log, hoping it could be useful
Screenshot 2020-12-16 at 11 22 36

I installed FacebookCore SDK via swift package (actually 8.2.0 version), so I was able to navigate into the code, and I saw that this crash happens in the line number 167 of FBSDKWebViewAppLinkResolver class, specifically when try to initialize an MKWebView inside the method
- (void)appLinkFromURL:(NSURL *)url handler:(FBSDKAppLinkBlock)handler
..
..
WKWebView *webView = [[WKWebView alloc] init]; (line 167)

At the very beginning of the method I can see those lines
dispatch_async(dispatch_get_main_queue(), ^{
[self followRedirects:url handler:^(NSDictionary<NSString *,id> *result, NSError * _Nullable error) {

IMO I think that followRedirects:url are not responding on main thread, so maybe putting
dispatch_async(dispatch_get_main_queue(), ^{
inside the followRedirects:url handler, could solve it.

Anyone else with the same issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions