2017-06-22 98 views
0

我想添加Facebook的分析我的第一次,但得到的目標C項目無法建立Facebook的SDK iOS版Xcode8

使用未聲明的標識符的「applicationDidBecomeaAtive」 enter image description here

此錯誤

我的步驟: 1-拷貝Bolts.framework和FBSDKCoreKit.framework

2-拷貝到AppDelegate.m

#import <FBSDKCoreKit/FBSDKCoreKit.h> 

3-但在這些線路

- (void)applicationDidBecomeActive:(UIApplication *)application { 
     [FBSDKAppEvents activateApp]; 
    } 

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

    - (BOOL)application:(UIApplication *)application 
openURL:(NSURL *)url 
sourceApplication:(NSString *)sourceApplication 
annotation:(id)annotation { 
    return [[FBSDKApplicationDelegate sharedInstance] application:application 
                  openURL:url 
               sourceApplication:sourceApplication 
                 annotation:annotation]; 
} 

回答

0
// 
// AppDelegate.m 
// myappgames 
// 
// Created by Vishal on 9/10/15. 
// Copyright (c) 2015 Vishal. All rights reserved. 
// 

#import "AppDelegate.h" 
#import "UIDevice+Res.h" 
#import <FBSDKCoreKit/FBSDKCoreKit.h> 



@interface AppDelegate() 

@end 

@implementation AppDelegate 
@synthesize navigationObj; 
@synthesize bannerViewAdUnitID,InterstitialAdUnitID; 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 
    [[FBSDKApplicationDelegate sharedInstance] application:application 
          didFinishLaunchingWithOptions:launchOptions]; 
    //--------Admob Ids--------- 
    bannerViewAdUnitID = @"ca-app-pub-00000"; 

    //--------InterstitialAd Ids--------- 
    InterstitialAdUnitID = @"ca-app-pub-00000000"; 


    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { 
     self.viewcontroller = [[ViewController alloc] initWithNibName:@"ViewController_IPad" bundle:nil]; 
     navigationObj = [[UINavigationController alloc]initWithRootViewController:self.viewcontroller]; 
     self.window.rootViewController = navigationObj; 
    } else { 
     self.viewcontroller = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil]; 
     navigationObj = [[UINavigationController alloc]initWithRootViewController:self.viewcontroller]; 
     self.window.rootViewController = navigationObj; 
    } 
    [self.window makeKeyAndVisible]; 
    return YES; 
} 



- (void)applicationDidBecomeActive:(UIApplication *)application 
{ 
    [FBSDKAppEvents activateApp]; 
} 



    - (BOOL)application:(UIApplication *)application 
openURL:(NSURL *)url 
sourceApplication:(NSString *)sourceApplication 
annotation:(id)annotation { 
    return [[FBSDKApplicationDelegate sharedInstance] application:application 
                  openURL:url 
               sourceApplication:sourceApplication 
                 annotation:annotation]; 
} 


- (void)applicationWillResignActive:(UIApplication *)application 
{ 
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 
} 

- (void)applicationDidEnterBackground:(UIApplication *)application 
{ 
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 
} 

- (void)applicationWillEnterForeground:(UIApplication *)application 
{ 
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 
} 



- (void)applicationWillTerminate:(UIApplication *)application 
{ 
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 
} 

@end 
+0

錯誤請你再次複製完整的代碼 – heythem500

+0

感謝測試它,你使用AppDelegate.m或.H?它仍然給我錯誤,將附加確切的代碼給你 – heythem500

+0

你可以編輯文件https://1drv.ms/u/s!AmM-qPDwBE3CgTNMxq8YfnYchbQE – heythem500