OSX link 错误的结构答案

Fabric Answers for OSX link error

尝试为 OSX 平台使用刚刚宣布的 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)

那是因为 Crashlytics 框架本身已经包含 Answers 框架。你只需要这样做:

播客文件:

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]]];
    ...
}