OSX链接错误的Fabric Answers

时间:2016-01-19 21:36:03

标签: macos cocoapods twitter-fabric

试图在OSX平台上使用annonced Answers框架:

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)

1 个答案:

答案 0 :(得分: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]]];
    ...
}