2016-10-22 1 views
0

Ich bin auf Schritt 5: Connect App Delegate von Getting Started with the Facebook SDK for iOS.Verwendung von nicht deklarierten Bezeichner beim Einrichten von Facebook SDK für iOS in React Native Init-Projekt

Ich habe den Code AppDelegate.m Datei wie angewiesen hinzugefügt. Ich erhalte jedoch die folgende Fehlermeldung: Verwendung der nicht deklarierten Bezeichner 'Anwendung', wobei der Code Anwendung: Anwendung liest.

Ich stelle mir vor, die zweite "Anwendung" muss durch etwas anderes ersetzt werden, aber ich weiß nicht was.

Hier ist der Code derzeit in meiner AppDeleage.m Datei. Die Datei wurde unter Verwendung von react-native init MyAppName erstellt und gemäß den Anweisungen von Facebook geändert.

/** 
* Copyright (c) 2015-present, Facebook, Inc. 
* All rights reserved. 
* 
* This source code is licensed under the BSD-style license found in the 
* LICENSE file in the root directory of this source tree. An additional grant 
* of patent rights can be found in the PATENTS file in the same directory. 
*/ 

#import "AppDelegate.h" 

#import "RCTBundleURLProvider.h" 
#import "RCTRootView.h" 
#import <FBSDKCoreKit/FBSDKCoreKit.h> 

@implementation AppDelegate 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    NSURL *jsCodeLocation; 

    jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; 

    RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 
                 moduleName:@"myAppName" 
               initialProperties:nil 
                launchOptions:launchOptions]; 
    rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 

    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 
    UIViewController *rootViewController = [UIViewController new]; 
    rootViewController.view = rootView; 
    self.window.rootViewController = rootViewController; 
    [self.window makeKeyAndVisible]; 

    [[FBSDKApplicationDelegate sharedInstance] application:application 
          didFinishLaunchingWithOptions:launchOptions]; 
    // Add any custom logic here. 
    return YES; 

} 

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

    BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application 
                    openURL:url 
                 sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey] 
                   annotation:options[UIApplicationOpenURLOptionsAnnotationKey] 
        ]; 
    // Add any custom logic here. 
    return handled; 
    } 

@end 

Antwort

3

In Ihrer application:openURL:options Implementierung wird der Parameter app und nicht application genannt.

Sie können entweder den Parameternamen application in der Methodensignatur ändern:

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

Oder Sie können die Parameter ändern, wenn auf die FBSDKApplicationDelegate Methode app Aufruf:

BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:app 
                   openURL:url 
                sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey] 
                  annotation:options[UIApplicationOpenURLOptionsAnnotationKey]]; 
Verwandte Themen