我正在开展一个去年创建的项目
最近,我想整合facebook SDK。
但是,当我将FacebookSDK
,#import <FacebookSDK/FacebookSDK.h>
添加到appdelegate.h
并构建时,它会在ACACcountType.m
文件中显示错误:
"pasting formed "Pasting formed '__NSi_@', an invalid preporcessing token".
请在此处查看屏幕截图:
我已经研究并试图改变[C ++语言方言]和[C语言方言]
[构建设置] - &gt; [Apple LLVM 5.0]但没有任何变化。
我被困在这里。请问你能帮帮我吗。非常感谢。
答案 0 :(得分:-1)
最近几个月Facebook SDK发生了很多变化,新的SDK不要求你向Appdelegate.h添加任何内容,如果你已下载它们,请查看示例应用程序并按照它们进行操作: / p> 在appdelegate.m中你应该有这样的东西(注意在app代理的其他部分中有关于FBsession控件的更多内容需要添加):
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[FBProfilePictureView class];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
UILocalNotification *localNotif =
[launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
if (localNotif) {
NSString *message =localNotif.alertBody;
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:localNotif.alertAction
message:message
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
application.applicationIconBadgeNumber = localNotif.applicationIconBadgeNumber-1;
}
//facebook items deprecated all items below are obsolete
/*
facebookController = [[QRSMFacebookVC alloc] init];
facebook = [[Facebook alloc] initWithAppId:kAppId andDelegate:facebookController];
// Check and retrieve authorization information
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if ([defaults objectForKey:@"FBAccessTokenKey"] && [defaults objectForKey:@"FBExpirationDateKey"]) {
facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"];
facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"];}
facebookController.facebook = facebook;
facebookController.userPermissions = userPermissions;
*/
// Initialize user permissions
// userPermissions = [[NSMutableDictionary alloc] initWithCapacity:10];
// Override point for customization after application launch.
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
// Although the SDK attempts to refresh its access tokens when it makes API calls,
// it's a good practice to refresh the access token also when the app becomes active.
// This gives apps that seldom make api calls a higher chance of having a non expired
// access token.
[FBSession.activeSession handleDidBecomeActive];
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// if the app is going away, we close the session object
[FBSession.activeSession close];
}
-(BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
BOOL ret = [FBSession.activeSession handleOpenURL:url];
return;
}