thebergamo / react-native-fbsdk-next

MIT License
687 stars 166 forks source link

When integrating react-native-fbsdk-next in IOS, App is opening with the blank screen #162

Closed gangadharuseline closed 2 years ago

gangadharuseline commented 2 years ago

🐛 Bug Report

On integrating react-native-fbsdk-next in IOS, App is opening with the blank screen

Goal Our Goal is to track App Installs from the facebook Ads.

To Reproduce

I followed below article to integrate the react-native-fbsdk-next. https://www.vairix.com/tech-blog/react-native-facebook-sdk-integration.

npx yarn install react-native-fbsdk-next

npx pod-install

In Info.plist,

<key>CFBundleURLTypes</key>
<array>
  <dict>
      <key>CFBundleURLSchemes</key>
      <array>
          <string>Acme</string> <!-- This line is added while integrating react-native-branch -->
          <string>fb[our_fb_app_id]</string>
      </array>
  </dict>
</array>

<key>LSApplicationQueriesSchemes</key>
<array>
  <string>fbapi</string>
  <string>fb-messenger-share-api</string>
</array>

<key>FacebookAppID</key>
<string>[our_fb_app_id]</string>
<key>FacebookDisplayName</key>
<string>Acme Corp</string>
<key>FacebookClientToken</key>
<string>[our_fb_client_id]</string>
<key>FacebookAutoLogAppEventsEnabled</key>
<true/>
<key>FacebookAdvertiserIDCollectionEnabled</key>
<true/>

Added the below lines in AppDelegate.m

#import <FBSDKCoreKit/FBSDKCoreKit.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[FBSDKApplicationDelegate sharedInstance] application:application
    didFinishLaunchingWithOptions:launchOptions];
// Other code ---
}

//- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options

  sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
//  return [RCTLinkingManager application:application openURL:url
//                      sourceApplication:sourceApplication annotation:annotation];

  if ([[FBSDKApplicationDelegate sharedInstance] application:app openURL:url options:options]) {
    return YES;
  }
  if ([RNBranch application:app openURL:url options:options])  {
    return YES;
  }
  return NO;

  //return [RNBranch application:app openURL:url options:options];

}

I was trying to run the app from xCode in my personal IPhone.(iPhone 12 Pro - OS version - 15.1.1)

The below is the xCode Log

2021-12-24 20:37:18.220024+0530 Acme[12866:1408261] You've implemented -[<UIApplicationDelegate> application:didReceiveRemoteNotification:fetchCompletionHandler:], but you still need to add "remote-notification" to the list of your supported UIBackgroundModes in your Info.plist.
2021-12-24 20:37:18.296955+0530 Acme[12866:1408466] 6.34.0 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) to your application initialization. Read more: https://goo.gl/ctyzm8.
2021-12-24 20:37:18.344054+0530 Acme[12866:1408261] File Path /private/var/containers/Bundle/Application/FFD49476-B011-447D-BC34-4B947CEAA294/Acme.app/GoogleService-Info_Dev.plist
2021-12-24 20:37:18.353124+0530 Acme[12866:1408472] 6.34.0 - [Firebase/Analytics][I-ACS025020] Analytics requires Google App ID from GoogleService-Info.plist. Your data may be lost. Google App ID has been changed. Original, new ID: 1:943915815926:ios:3c0b000b6199e0b905add7, 1:732520158131:ios:62300deac1358ff41eb1c6
2021-12-24 20:37:18.354046+0530 Acme[12866:1408472] 6.34.0 - [Firebase/Analytics][I-ACS023007] Analytics v.60900000 started
2021-12-24 20:37:18.354129+0530 Acme[12866:1408472] 6.34.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r)
2021-12-24 20:37:18.360495+0530 Acme[12866:1408466] 6.34.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
2021-12-24 20:37:18.360979+0530 Acme[12866:1408261] [Firebase/Crashlytics] Version 4.6.2
2021-12-24 20:37:18.458822+0530 Acme[12866:1408261] RELEASE
2021-12-24 20:37:18.461076+0530 Acme[12866:1408261] RELEASE
2021-12-24 20:37:18.462652+0530 Acme[12866:1408261] [native] Running application acme_app ({
    initialProps =     {
    };
    rootTag = 1;
})
2021-12-24 20:37:18.484869+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "activator://package/com.example.package" - error: "This app is not allowed to query for scheme activator"
2021-12-24 20:37:18.485633+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "cydia://package/com.example.package" - error: "This app is not allowed to query for scheme cydia"
2021-12-24 20:37:18.485885+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "filza://package/com.example.package" - error: "This app is not allowed to query for scheme filza"
2021-12-24 20:37:18.486640+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "sileo://package/com.example.package" - error: "This app is not allowed to query for scheme sileo"
2021-12-24 20:37:18.487108+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "undecimus://package/com.example.package" - error: "This app is not allowed to query for scheme undecimus"
2021-12-24 20:37:18.487373+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "zbra://package/com.example.package" - error: "This app is not allowed to query for scheme zbra"
2021-12-24 20:37:18.498135+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "activator://package/com.example.package" - error: "This app is not allowed to query for scheme activator"
2021-12-24 20:37:18.498400+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "cydia://package/com.example.package" - error: "This app is not allowed to query for scheme cydia"
2021-12-24 20:37:18.498616+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "filza://package/com.example.package" - error: "This app is not allowed to query for scheme filza"
2021-12-24 20:37:18.498818+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "sileo://package/com.example.package" - error: "This app is not allowed to query for scheme sileo"
2021-12-24 20:37:18.499053+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "undecimus://package/com.example.package" - error: "This app is not allowed to query for scheme undecimus"
2021-12-24 20:37:18.499276+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "zbra://package/com.example.package" - error: "This app is not allowed to query for scheme zbra"
2021-12-24 20:37:18.507965+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "activator://package/com.example.package" - error: "This app is not allowed to query for scheme activator"
2021-12-24 20:37:18.508171+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "cydia://package/com.example.package" - error: "This app is not allowed to query for scheme cydia"
2021-12-24 20:37:18.508376+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "filza://package/com.example.package" - error: "This app is not allowed to query for scheme filza"
2021-12-24 20:37:18.508566+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "sileo://package/com.example.package" - error: "This app is not allowed to query for scheme sileo"
2021-12-24 20:37:18.508767+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "undecimus://package/com.example.package" - error: "This app is not allowed to query for scheme undecimus"
2021-12-24 20:37:18.508958+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "zbra://package/com.example.package" - error: "This app is not allowed to query for scheme zbra"
2021-12-24 20:37:18.510421+0530 Acme[12866:1408473] 6.34.0 - [Firebase/Analytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement
2021-12-24 20:37:18.521650+0530 Acme[12866:1408473] [Client] Updating selectors after delegate addition failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service with pid 93 named com.apple.commcenter.coretelephony.xpc was invalidated from this process." UserInfo={NSDebugDescription=The connection to service with pid 93 named com.apple.commcenter.coretelephony.xpc was invalidated from this process.}
[VGSCollectSDK -  Final URL to validate custom hostname: https://js.verygoodvault.com/collect-configs.x.txt - logLevel: info]
[VGSCollectSDK -  Final URL to validate custom hostname: https://js.verygoodvault.com/collect-configs.x.txt - logLevel: info]
2021-12-24 20:37:18.528799+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "activator://package/com.example.package" - error: "This app is not allowed to query for scheme activator"
2021-12-24 20:37:18.529059+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "cydia://package/com.example.package" - error: "This app is not allowed to query for scheme cydia"
2021-12-24 20:37:18.529330+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "filza://package/com.example.package" - error: "This app is not allowed to query for scheme filza"
2021-12-24 20:37:18.529566+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "sileo://package/com.example.package" - error: "This app is not allowed to query for scheme sileo"
2021-12-24 20:37:18.529773+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "undecimus://package/com.example.package" - error: "This app is not allowed to query for scheme undecimus"
2021-12-24 20:37:18.530064+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "zbra://package/com.example.package" - error: "This app is not allowed to query for scheme zbra"
2021-12-24 20:37:18.540761+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "activator://package/com.example.package" - error: "This app is not allowed to query for scheme activator"
2021-12-24 20:37:18.542486+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "cydia://package/com.example.package" - error: "This app is not allowed to query for scheme cydia"
2021-12-24 20:37:18.545125+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "filza://package/com.example.package" - error: "This app is not allowed to query for scheme filza"
2021-12-24 20:37:18.545350+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "sileo://package/com.example.package" - error: "This app is not allowed to query for scheme sileo"
2021-12-24 20:37:18.545536+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "undecimus://package/com.example.package" - error: "This app is not allowed to query for scheme undecimus"
2021-12-24 20:37:18.545715+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "zbra://package/com.example.package" - error: "This app is not allowed to query for scheme zbra"
2021-12-24 20:37:18.554901+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "activator://package/com.example.package" - error: "This app is not allowed to query for scheme activator"
2021-12-24 20:37:18.555142+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "cydia://package/com.example.package" - error: "This app is not allowed to query for scheme cydia"
2021-12-24 20:37:18.555415+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "filza://package/com.example.package" - error: "This app is not allowed to query for scheme filza"
2021-12-24 20:37:18.555604+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "sileo://package/com.example.package" - error: "This app is not allowed to query for scheme sileo"
2021-12-24 20:37:18.555912+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "undecimus://package/com.example.package" - error: "This app is not allowed to query for scheme undecimus"
2021-12-24 20:37:18.556148+0530 Acme[12866:1408261] -canOpenURL: failed for URL: "zbra://package/com.example.package" - error: "This app is not allowed to query for scheme zbra"
[VGSCollectSDK -  Final URL to validate custom hostname: https://js.verygoodvault.com/collect-configs.x.txt - logLevel: info]
2021-12-24 20:37:18.571242+0530 Acme[12866:1408462] [Client] Updating selectors after delegate addition failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service with pid 93 named com.apple.commcenter.coretelephony.xpc was invalidated from this process." UserInfo={NSDebugDescription=The connection to service with pid 93 named com.apple.commcenter.coretelephony.xpc was invalidated from this process.}
2021-12-24 20:37:18.610731+0530 Acme[12866:1408462] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}>
2021-12-24 20:37:18.610840+0530 Acme[12866:1408462] [ProcessSuspension] 0x10ebf9980 - ProcessAssertion: Failed to acquire RBS assertion 'ConnectionTerminationWatchdog' for process with PID=12869, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}
2021-12-24 20:37:18.624929+0530 Acme[12866:1408459] [general] *** -[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving safe plist type ''NSString' (0x1db07f6e8) [/System/Library/Frameworks/Foundation.framework]' for key 'NS.keys', even though it was not explicitly included in the client allowed classes set: '{(
    "'NSDate' (0x1db074ac0) [/System/Library/Frameworks/CoreFoundation.framework]",
    "'NSDictionary' (0x1db074c28) [/System/Library/Frameworks/CoreFoundation.framework]"
)}'. This will be disallowed in the future.
2021-12-24 20:37:18.641394+0530 Acme[12866:1408459] [general] *** -[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving safe plist type ''NSString' (0x1db07f6e8) [/System/Library/Frameworks/Foundation.framework]' for key 'NS.keys', even though it was not explicitly included in the client allowed classes set: '{(
    "'NSDate' (0x1db074ac0) [/System/Library/Frameworks/CoreFoundation.framework]",
    "'NSDictionary' (0x1db074c28) [/System/Library/Frameworks/CoreFoundation.framework]"
)}'. This will be disallowed in the future.
2021-12-24 20:37:18.662511+0530 Acme[12866:1408460] 6.34.0 - [Firebase/Analytics][I-ACS023012] Analytics collection enabled
2021-12-24 20:37:18.662620+0530 Acme[12866:1408460] 6.34.0 - [Firebase/Analytics][I-ACS023220] Analytics screen reporting is enabled. Call +[FIRAnalytics logEventWithName:FIREventScreenView parameters:] to log a screen view event. To disable automatic screen reporting, set the flag FirebaseAutomaticScreenReportingEnabled to NO (boolean) in the Info.plist
2021-12-24 20:37:18.707179+0530 Acme[12866:1408484] [native] Unbalanced calls start/end for tag 12
2021-12-24 20:37:18.712908+0530 Acme[12866:1408485] [native] Unbalanced calls start/end for tag 12
2021-12-24 20:37:18.732428+0530 Acme[12866:1408464] Attribution returned an error: Error Domain=ADClientErrorDomain Code=1 "The app is not authorized for ad tracking" UserInfo={NSLocalizedDescription=The app is not authorized for ad tracking}
2021-12-24 20:37:18.732968+0530 Acme[12866:1408464] 6.34.0 - [Firebase/Analytics][I-ACS032010] Cannot send request for Search Ad campaign attribution. Error: Error Domain=ADClientErrorDomain Code=1 "The app is not authorized for ad tracking" UserInfo={NSLocalizedDescription=The app is not authorized for ad tracking}
2021-12-24 20:37:18.746016+0530 Acme[12866:1408485] [native] Unbalanced calls start/end for tag 12
2021-12-24 20:37:18.990618+0530 Acme[12866:1408463] 6.34.0 - [Firebase/Analytics][I-ACS023012] Analytics collection enabled
2021-12-24 20:37:18.990699+0530 Acme[12866:1408463] 6.34.0 - [Firebase/Analytics][I-ACS023220] Analytics screen reporting is enabled. Call +[FIRAnalytics logEventWithName:FIREventScreenView parameters:] to log a screen view event. To disable automatic screen reporting, set the flag FirebaseAutomaticScreenReportingEnabled to NO (boolean) in the Info.plist
2021-12-24 20:37:19.021721+0530 Acme[12866:1408459] 6.34.0 - [Firebase/Analytics][I-ACS023012] Analytics collection enabled
2021-12-24 20:37:19.021816+0530 Acme[12866:1408459] 6.34.0 - [Firebase/Analytics][I-ACS023220] Analytics screen reporting is enabled. Call +[FIRAnalytics logEventWithName:FIREventScreenView parameters:] to log a screen view event. To disable automatic screen reporting, set the flag FirebaseAutomaticScreenReportingEnabled to NO (boolean) in the Info.plist
2021-12-24 20:37:19.028500+0530 Acme[12866:1408485] [native] Unbalanced calls start/end for tag 1
2021-12-24 20:37:19.076199+0530 Acme[12866:1408451] [native] Manifest does not exist - creating a new one.

(null)
2021-12-24 20:37:19.156547+0530 Acme[12866:1408261] [native] [GESTURE HANDLER] Initialize gesture handler for root view <RCTRootContentView: 0x105f52a70; reactTag: 1; frame = (0 0; 390 844); gestureRecognizers = <NSArray: 0x2827c3b40>; layer = <CALayer: 0x282905220>>
2021-12-24 20:37:19.212159+0530 Acme[12866:1408261] [native] Invalidating <RCTCxxBridge: 0x105f51d50> (parent: (null), executor: (null))
2021-12-24 20:37:19.274172+0530 Acme[12866:1408464] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}>
2021-12-24 20:37:19.274230+0530 Acme[12866:1408464] [ProcessSuspension] 0x10ebf9aa0 - ProcessAssertion: Failed to acquire RBS assertion 'ConnectionTerminationWatchdog' for process with PID=12868, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}
2021-12-24 20:37:19.275903+0530 Acme[12866:1408459] [general] *** -[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving safe plist type ''NSString' (0x1db07f6e8) [/System/Library/Frameworks/Foundation.framework]' for key 'NS.keys', even though it was not explicitly included in the client allowed classes set: '{(
    "'NSDate' (0x1db074ac0) [/System/Library/Frameworks/CoreFoundation.framework]",
    "'NSDictionary' (0x1db074c28) [/System/Library/Frameworks/CoreFoundation.framework]"
)}'. This will be disallowed in the future.

Expected Behavior

App should load properly and work as expected. And be able to track the App Installs from Facebook Ads.

Environment

"react-native": "0.63.2", Xcode version 13.0 SDK version react-native-fbsdk-next - 6.1.1

rnike commented 2 years ago

Try this instead in your AppDelegate.m

initialize

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];

  // ... your other code
}

handle links

- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
            options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
  // https://developers.facebook.com/docs/ios/getting-started/#app-delegate
  BOOL handlFacebook = [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url options:options];
  BOOL handleLinkingManager = [RCTLinkingManager application:application openURL:url options:options];

  return handlFacebook || handleLinkingManager;
}
gangadharuseline commented 2 years ago

Thanks for the reply @rnike . No Luck with the above change. Same issue

rnike commented 2 years ago

I'm curious why you have links prefix with cydia, filza, undecimus ... , those looks like jailbreak stuff for me, perhaps you can try something described in this post

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.