0

我将 Layar SDK 框架包含到我的应用程序(8.0 版)中,并且在设备上一切正常。

但是,我不能再在模拟器上运行应用程序了——我不介意 Layar 不工作(毕竟没有摄像头!)但我确实需要它来编译以进行持续集成、自动化测试等(更不用说在火车顶部/下班!)

链接器给了我这些错误:

ld: warning: ignoring file /Users/username/Documents/appname/libs/MPOAuth/libMPOAuthMobile.a, missing required architecture i386 in file /Users/username/Documents/appname/libs/MPOAuth/libMPOAuthMobile.a (2 slices)
ld: warning: ignoring file local/LayarSDK/LayarSDK.framework/LayarSDK, missing required architecture i386 in file local/LayarSDK/LayarSDK.framework/LayarSDK (2 slices)
Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_LayarSDK", referenced from:
    objc-class-ref in MYAppDelegate.o
ld: symbol(s) not found for architecture i386

检查,LayarSDK 不包含i386,它只包含armv7and armv7s

4

1 回答 1

1

我的解决方案非常笨拙-如果有人有更好的主意,请告诉我!

我将此文件 () 编译LayarSimulatorStub.m到我的应用程序中:

#if TARGET_IPHONE_SIMULATOR

#import <Foundation/Foundation.h>

@interface LayarSDK : NSObject

@end

@implementation LayarSDK

+ (id)layarSDKWithConsumerKey:(id)a andConsumerSecret:(id)b andDelegate:(id)c { return nil; }
- (id)init { return nil; }
- (id)initWithConsumerKey:(id)a andConsumerSecret:(id)b andDelegate:(id)c { return nil; }

@end

#endif

现在,一个i386符号LayarSDK。它只是nil从它的所有构造函数中返回。该应用程序现在可以在禁用 Layar 的情况下编译。

条件编译意味着它不存在于设备架构中,因此没有链接器错误。

于 2014-01-15T12:32:43.670 回答