2016-01-19 52 views
6

面料答案嘗試使用剛剛annonced Answers框架OSX平臺:的OSX鏈接錯誤

pod 'Fabric' 
pod 'Answers' 
pod 'Crashlytics' 

#import <Fabric/Fabric.h> 
#import <Answers/Answers.h> 
#import <Crashlytics/Crashlytics.h> 

[Fabric with:@[[Crashlytics class], [Answers class]]]; 

,並得到一堆錯誤:

... 
duplicate symbol _OBJC_METACLASS_$_CLSAnswersInviteEvent in: 
/Users/k06a/Projects/UXMaterial/Pods/Answers/OSX/Answers.framework/Answers(CLSAnswersInviteEvent.o) 
/Users/k06a/Projects/UXMaterial/Pods/Crashlytics/OSX/Crashlytics.framework/Crashlytics(CLSAnswersInviteEvent.o) 
ld: 200 duplicate symbols for architecture x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

回答

16

那是因爲Crashlytics框架已經包含了其自身內部Answers框架。你只需要做到這一點:

Podfile:

pod 'Fabric' 
pod 'Crashlytics' 

你AppDelegate.m:

#import <Fabric/Fabric.h> 
#import <Crashlytics/Answers.h> 
#import <Crashlytics/Crashlytics.h> 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 
    ... 
    [Fabric with:@[[Crashlytics class], [Answers class]]]; 
    ... 
} 
+3

爲SWIFT僅進口面料和Crashlytics,因爲答案對象包含在Crashlytics :) – Greg