5

在我的 Xcode 项目中,我集成了 XMPP 框架。它在 iOS 5.1 模拟器上运行良好。当我尝试在 iOS 4.3 模拟器上运行该项目时,出现以下错误:

dyld: lazy symbol binding failed: Symbol not found: _objc_storeStrong
  Referenced from: /Users/admin/Library/Application Support/iPhone Simulator/4.3.2/Applications/67451DE6-EFC1-4313-9A29-C2C641F727C6/AppName.app/AppName
  Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/Foundation.framework/Foundation

dyld: Symbol not found: _objc_storeStrong
  Referenced from: /Users/admin/Library/Application Support/iPhone Simulator/4.3.2/Applications/67451DE6-EFC1-4313-9A29-C2C641F727C6/AppName.app/AppName
  Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/Foundation.framework/Foundation

错误发生在以下代码行:xmppStream = [[XMPPStream alloc] init];

经过进一步调试,我发现错误发生在这里:

- (id)init
{
    if ((self = [super init])) //**CRASH WHEN EXECUTING THIS STATEMENT
    {
        // Common initialization
        [self commonInit];

        // Initialize socket
        asyncSocket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:xmppQueue];
    }
    return self;
}


我集成 XMPP 的项目不是 ARC。所以我对所有 XMPP 文件添加了-fobjc-arc 。XMPP 库提供的示例项目在 iOS 4.3 模拟器上运行良好。谁能帮我解决这个错误?
Xcode 版本:4.3.3
iOS:iOS 4.3 模拟器

4

1 回答 1

0

如果 XMPP 需要 ARC,并且您明确将其关闭,则会发生这种链接器错误。尝试-fno-objc-arc从 XMPP 文件中删除并添加-fobjc-arc项目的其他链接器标志。更多信息

于 2013-01-28T10:36:14.890 回答