iphone - 将项目移至 xcode 4 会出现“Apple Mach-O Linker (Id) Error”

标签 iphone objective-c ios xcode xcode4

我升级到 XCode 4,但我的一个项目无法再编译。有人遇到过这个问题吗?下面是完整的错误堆栈(为了易读性而稍微重新格式化):

Ld /Users/stephen/Library/Developer/Xcode/DerivedData/viewer-dsbfkuoythcgojfrsktxcccyfnuj/Build/Products/Debug-iphonesimulator/viewer.app/viewer normal i386
cd /Users/stephen/projects/Quipper/iPhone-viewer
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 \
    -arch i386 \
    -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk \
    -L/Users/stephen/Library/Developer/Xcode/DerivedData/viewer-dsbfkuoythcgojfrsktxcccyfnuj/Build/Products/Debug-iphonesimulator \
    -L/Users/stephen/projects/Quipper/iPhone-viewer/AdMob \
    "-L/Users/stephen/projects/Quipper/iPhone-viewer/Twitter+OAuth/Libraries & Headers" \
    -L/Users/stephen/projects/Quipper/iPhone-viewer/FlurryLib \
    -F/Users/stephen/Library/Developer/Xcode/DerivedData/viewer-dsbfkuoythcgojfrsktxcccyfnuj/Build/Products/Debug-iphonesimulator \
    -filelist /Users/stephen/Library/Developer/Xcode/DerivedData/viewer-dsbfkuoythcgojfrsktxcccyfnuj/Build/Intermediates/viewer.build/Debug-iphonesimulator/viewer.build/Objects-normal/i386/viewer.LinkFileList \
    -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 \
    -framework CoreGraphics -framework CoreData -lAdMob -framework iAd \
    -framework StoreKit -framework MediaPlayer -lOAuth -lxml2.2 \
    -framework MessageUI -framework CoreLocation -framework QuartzCore \
    -framework CoreMedia -framework AVFoundation -framework SystemConfiguration \
    -framework CoreAudio -framework AudioToolbox -framework Foundation \
    -framework UIKit -lFlurry -framework OpenAL \
    -o /Users/stephen/Library/Developer/Xcode/DerivedData/viewer-dsbfkuoythcgojfrsktxcccyfnuj/Build/Products/Debug-iphonesimulator/viewer.app/viewer

ld: duplicate symbol _OBJC_IVAR_$_StartChallengeViewController.user_pack_id
    in /Users/stephen/Library/Developer/Xcode/DerivedData/viewer-dsbfkuoythcgojfrsktxcccyfnuj/Build/Intermediates/viewer.build/Debug-iphonesimulator/viewer.build/Objects-normal/i386/StartChallengeViewController-C52C140DA244D284.o
    and /Users/stephen/Library/Developer/Xcode/DerivedData/viewer-dsbfkuoythcgojfrsktxcccyfnuj/Build/Intermediates/viewer.build/Debug-iphonesimulator/viewer.build/Objects-normal/i386/StartChallengeViewController-469DDEB33F89F484.o
    for architecture i386
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 failed with exit code 1

最佳答案

您已在 2 个不同的类中声明了具有相同名称的指定值(例如 int i = 2;)的全局 iVar,其中一个类是 StartChallengeViewController 。如果清理项目(Cmd Shift K)没有帮助,请尝试将其中一个 iVar 重命名为其他名称,或者不为其指定初始值。

关于iphone - 将项目移至 xcode 4 会出现“Apple Mach-O Linker (Id) Error”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6634275/

相关文章:

iphone - 手动核心数据版本控制

objective-c - ios 中的 UIButton AddTarget(不工作-崩溃)

ios - 使用 MKNetworkKit 时一个 MKNetworkEngine 对象

iphone - 如何在最后一个单元格上启动 UITableView?

ios - NSURLSession 中的委托(delegate)和完成处理程序

ios - 如何为不同的 UITableView 部分使用不同的 TableView 单元格类

ios - 您如何以 YYYY-MM-DD 格式快速获取上周日期?

objective-c - 如何使用 enabledRemoteNotificationTypes 更新代码,因为它是 "not supported in iOS 8"?

iphone - 使用委托(delegate)和 IBActions 进行子类化

ios - 无法提交对通过 iTunes Connect 提交的 iPhone 应用程序的修复