找不到 FacebookSDK/FacebookSDK.h
Posted
技术标签:
【中文标题】找不到 FacebookSDK/FacebookSDK.h【英文标题】:can't find FacebookSDK/FacebookSDK.h 【发布时间】:2015-05-11 18:58:01 【问题描述】:我是一名 android 开发人员,我是 Xcode 和 Objective-c 的新手。
我在我的应用程序中使用 parse.com,我正在尝试添加使用面部登录的功能,但是,ParseFacebookUtils
框架的标头之一需要标头 FacebookSDK
,它不再包含在新的 Facebook SDK。
进一步调查显示我需要 FBSession 标头,但我也找不到。
有解决办法吗?我正在使用最新的 Xcode,解析 sdks 和 Facebook sdks。
编辑:
[PFFacebookUtils logInInBackgroundWithReadPermissions:@[@"public_profile", @"user_about_me", @"user_friends", @"email"] block:^(PFUser *user, NSError *error)
NSLog(@"Im here anyway!");
if (!user)
NSLog(@"Uh oh. The user cancelled the Facebook login.");
else if (user.isNew)
NSLog(@"User signed up and logged in through Facebook!");
else
NSLog(@"User logged in through Facebook!");
];
EDIT2:
//
// AppDelegate.m
// Listo
//
// Created by Amit Baz on 5/12/15.
// Copyright (c) 2015 Amit Baz. All rights reserved.
//
#import "AppDelegate.h"
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
#import <ParseFacebookUtilsV4/PFFacebookUtils.h>
#import <Parse/Parse.h>
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
// Override point for customization after application launch.
[FBSDKLoginButton class];
[Parse setApplicationId:@""
clientKey:@""];
[PFFacebookUtils initializeFacebookWithApplicationLaunchOptions:launchOptions];
[PFAnalytics trackAppOpenedWithLaunchOptions:launchOptions];
return YES;
- (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)applicationDidBecomeActive:(UIApplication *)application
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
[FBSDKAppEvents activateApp];
- (void)applicationWillTerminate:(UIApplication *)application
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
return [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation];
@end
【问题讨论】:
【参考方案1】:Parse 支持 Facebook SDK 的 v4.x 和 v3.x。如果您使用的是 Facebook SDK 的 v4.x,则无需导入 ParseFacebookUtils
,您需要:
#import <ParseFacebookUtilsV4/PFFacebookUtils.h>
请参阅https://www.parse.com/docs/ios/guide#fbusers 了解更多信息。
【讨论】:
谢谢您的好心先生!这样可行!但是,当我尝试通过 Facebook 连接帖子中的消息(已编辑)时,没有写入控制台的日志,这意味着该消息“不起作用”,你能帮我吗? 调用该方法时会发生什么?它会切换到 Facebook 应用程序还是 Safari?您的 plist 中是否将 fbapp_id 列为方案? 它切换到 safari,因为我在模拟器中没有 fb 应用程序,并且我确实将 fbapp_id 列为 URL 类型中的方案 在这种情况下,当您完成登录时,它会打开您的应用程序吗?如果是这样,您是否从 AppDelegate 调用FBSDKApplicationDelegate
的 application:openURL:sourceApplication:annotation:
方法?
我有这个方法但我不叫她【参考方案2】:
从以下位置删除 FacebookSDK Build Phases--> Link Binary With Libraries 删除 FacebookSDK.framework 再次添加 FacebookSDK 框架
【讨论】:
没有FacebookSDK.framework了...新的sdk包含其他框架【参考方案3】:看起来 Facebook SDK 在 v4.0 中进行了重大更新,将其拆分为多个框架。在更新 parse 以使用新的 SDK 之前,您必须下载并使用 v3.x 或更低版本的 Facebook SDK。
【讨论】:
在哪里可以找到更低的版本?以上是关于找不到 FacebookSDK/FacebookSDK.h的主要内容,如果未能解决你的问题,请参考以下文章