我需要使用iOS上的Native Implementation登录Facebook,以便将登录行为更改为Web视图。为了实现这一点,我需要#import
Facebook SDK。我只需要FBSDKLoginKit.framework
文件。所以我从Facebook开发者网站下载了Facebook SDK,然后将FBSDKLoginKit.framework
文件从SDK复制到我的cn1项目中的native / iOS目录。这是我的原生代码:
#import "za_co_bonyelo_mibrand_NativeImplImpl.h"
#import <FBSDKLoginKit/Headers/FBSDKLoginKit.h>
@implementation za_co_bonyelo_mibrand_NativeImplImpl
-(void)facebookLogin {
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login setLoginBehavior:FBSDKLoginBehaviorWeb];
[login logInWithReadPermissions:@[@"public_profile"]
fromViewController:nil handler:^(FBSDKLoginManagerLoginResult
*result, NSError *error) {
NSLog(@"");
}];
}
-(BOOL)isSupported {
return YES;
}
@end
当我发送构建时,我收到构建错误,日志显示:FBSDKLoginKit/Headers/FBSDKLoginKit.h
找不到文件。我尝试将导入放入“引用”而不是&lt;&gt;,我还尝试删除.framework
文件,因为我知道cn1已经安装了SDK但我仍然遇到了同样的错误。我在这做错了什么?我是否需要在cn1服务器上存储SDK的目录,或者我导入错误。我将框架添加到XCode项目并添加了相同的代码,我没有编译错误。我还添加了构建提示:
ios.add_libs=F.framework;Second.framework;FBSDKLoginKit.framework
谢谢。
更新。构建错误:
** BUILD FAILED **
The following build commands failed:
CompileC /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build8449449665536309564xxx/dist/build/Build/Intermediates/Pods.build/Release-iphoneos/Bolts.build/Objects-normal/armv7/BFAppLinkNavigation.o Bolts/Bolts/iOS/BFAppLinkNavigation.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build8449449665536309564xxx/dist/build/Build/Intermediates/Pods.build/Release-iphoneos/Bolts.build/Objects-normal/armv7/BFCancellationToken.o Bolts/Bolts/Common/BFCancellationToken.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build8449449665536309564xxx/dist/build/Build/Intermediates/Pods.build/Release-iphoneos/Bolts.build/Objects-normal/armv7/BFCancellationTokenRegistration.o Bolts/Bolts/Common/BFCancellationTokenRegistration.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build8449449665536309564xxx/dist/build/Build/Intermediates/Pods.build/Release-iphoneos/Bolts.build/Objects-normal/armv7/BFCancellationTokenSource.o Bolts/Bolts/Common/BFCancellationTokenSource.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build8449449665536309564xxx/dist/build/Build/Intermediates/Pods.build/Release-iphoneos/Bolts.build/Objects-normal/armv7/BFExecutor.o Bolts/Bolts/Common/BFExecutor.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(5 failures)
I also found errors like these when I looked through the logs.
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:52:31: error: expected '>'
@interface BFTask<__covariant ResultType> : NSObject
^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:52:31: error: unknown type name 'ResultType'; did you mean 'ResType'?
@interface BFTask<__covariant ResultType> : NSObject
^~~~~~~~~~
ResType
In module 'UIKit' imported from /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Target Support Files/Bolts/Bolts-prefix.pch:2:
In module 'Darwin' imported from /Applications/Xcode6.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKitDefines.h:8:
/Applications/Xcode6.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk/usr/include/MacTypes.h:292:41: note: 'ResType' declared here
typedef FourCharCode ResType;
^
In file included from /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.m:11:
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:52:41: error: expected identifier or '('
@interface BFTask<__covariant ResultType> : NSObject
^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:63:33: error: expected a type
+ (instancetype)taskWithResult:(nullable ResultType)result;
^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:63:1: error: missing context for method declaration
+ (instancetype)taskWithResult:(nullable ResultType)result;
^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:69:1: error: expected method body
+ (instancetype)taskWithError:(NSError *)error;
^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:75:1: error: missing context for method declaration
+ (instancetype)taskWithException:(NSException *)exception;
^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:80:1: error: expected method body
+ (instancetype)cancelledTask;
^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:87:46: error: expected a type
+ (instancetype)taskForCompletionOfAllTasks:(nullable NSArray<BFTask *> *)tasks;
^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:87:1: error: missing context for method declaration
+ (instancetype)taskForCompletionOfAllTasks:(nullable NSArray<BFTask *> *)tasks;
^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:95:1: error: expected method body
+ (instancetype)taskForCompletionOfAllTasksWithResults:(nullable NSArray<BFTask *> *)tasks;
^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:103:45: error: expected a type
+ (instancetype)taskForCompletionOfAnyTask:(nullable NSArray<BFTask *> *)tasks;
^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:103:1: error: missing context for method declaration
+ (instancetype)taskForCompletionOfAnyTask:(nullable NSArray<BFTask *> *)tasks;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.