0

我可以使用一些帮助来解决我在尝试运行我的项目时不断遇到的错误。

我的项目已经通过应用内购买发布。在我的最新版本中,我尝试将 IAP 合并到另一个视图控制器中,但是当我想运行时,我得到两个 Apple Mach-O 链接器错误和一个 Dsymutil 错误。

自从我上次发布版本以来,我可能已经更新了 Xcode(到版本 4.6 (4H127)),但我不确定。

我已经检查过的一些事情:

  • Link Binary With Binaries 似乎仍然包含所有必要的框架;
  • 编译源似乎包括我所有的 .m 文件;
  • 我在代码中的任何地方都找不到 __products (我可以找到 _products ......:我用该名称创建了一个全局变量(之前是一个局部变量))
  • 我也尝试在模拟器和设备上运行。

全局变量在 .h 文件中声明,该文件被导入到需要它的视图控制器中:extern NSArray *_products;

我不确定我的外部框架/库是否会造成任何麻烦。他们以前工作得很好:TestFlight、Appirater、CHCSVParser。

错误:

ld“/Users/jaspervandermaarel/Library/Developer/Xcode/DerivedData/Mijn_Kinderen-dglsdifvjduysjbpixoiuyaekgky/Build/Products/Debug-iphonesimulator/Mijn Kinderen.app/Mijn Kinderen”正常 i386 cd“/Users/jaspervandermaarel/Documents/Xcode projects/Mijn Kinderen" setenv IPHONEOS_DEPLOYMENT_TARGET 5.0 setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin :/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/平台/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1。sdk -L/Users/jaspervandermaarel/Library/Developer/Xcode/DerivedData/Mijn_Kinderen-dglsdifvjduysjbpixoiuyaekgky/Build/Products/Debug-iphonesimulator "-L/Users/jaspervandermaarel/Documents/Xcode projects/Mijn Kinderen/TestFlightSDK1-1""-L /Users/jaspervandermaarel/Documents/Xcode projects/Mijn Kinderen”-F/Users/jaspervandermaarel/Library/Developer/Xcode/DerivedData/Mijn_Kinderen-dglsdifvjduysjbpixoiuyaekgky/Build/Products/Debug-iphonesimulator -filelist”/Users/jaspervandermaarel/Library/Developer /Xcode/DerivedData/Mijn_Kinderen-dglsdifvjduysjbpixoiuyaekgky/Build/Intermediates/Mijn Kinderen.build/Debug-iphonesimulator/Mijn Kinderen.build/Objects-normal/i386/Mijn Kinderen.LinkFileList" -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc - fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=5。0 -weak_framework Accounts -weak_framework Social -framework SystemConfiguration -framework CFNetwork -framework StoreKit -framework MessageUI -lz -framework UIKit -framework Foundation -framework CoreGraphics -framework CoreData -lTestFlight -o "/Users/jaspervandermaarel/Library/Developer/Xcode/DerivedData /Mijn_Kinderen-dglsdifvjduysjbpixoiuyaekgky/Build/Products/Debug-iphonesimulator/Mijn Kinderen.app/Mijn Kinderen"

架构 i386 的未定义符号:“__products”,引用自:-[MKGebeurtenissenViewController voegToeGebeurtenis:] in MKGebeurtenissenViewController.o -[MKGebeurtenissenViewController alertView:clickedButtonAtIndex:] in MKGebeurtenissenViewController.o -[MKKinderenViewController alertView:clickedButtonAtIndex:] in MKKinderenViewController.o -[MKKinderenViewController productPurchased:] 在 MKKinderenViewController.o -[MKKinderenViewController voegKindToe:] 在 MKKinderenViewController.o -[MKGebeurtenissenViewController voegToeGebeurtenis:] 在 MKGebeurtenissenViewController.o -[MKGebeurtenissenViewController alertView:clickedButtonAtIndex:] 在 MKGebeurtenissenViewController.o -[MKKinderenViewController 中的 MKKinderenView:clickedButtonAtIndex:.o -[MKKinderenViewController productPurchased:] in MKKinderenViewController.o -[MKKinderenViewController voegKindToe:] in MKKinderenViewController.o ld:未找到架构 i386 的符号 clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

GenerateDSYMFile "/Users/jaspervandermaarel/Library/Developer/Xcode/DerivedData/Mijn_Kinderen-dglsdifvjduysjbpixoiuyaekgky/Build/Products/Debug-iphonesimulator/Mijn Kinderen.app.dSYM" "/Users/jaspervandermaarel/Library/Developer/Xcode/DerivedData/Mijn_Kinderen- dglsdifvjduysjbpixoiuyaekgky/Build/Products/Debug-iphonesimulator/Mijn Kinderen.app/Mijn Kinderen" cd "/Users/jaspervandermaarel/Documents/Xcode projects/Mijn Kinderen" setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator .platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer /Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil"/Users/jaspervandermaarel/Library/Developer/Xcode/DerivedData/Mijn_Kinderen-dglsdifvjduysjbpixoiuyaekgky/Build/Products/Debug-iphonesimulator/Mijn Kinderen.app/Mijn Kinderen"-o"/Users/jaspervandermaarel/Library/Developer/Xcode/DerivedData/Mijn_Kinderen -dglsdifvjduysjbpixoiuyaekgky/Build/Products/Debug-iphonesimulator/Mijn Kinderen.app.dSYM"

错误:无法打开可执行文件'/Users/jaspervandermaarel/Library/Developer/Xcode/DerivedData/Mijn_Kinderen-dglsdifvjduysjbpixoiuyaekgky/Build/Products/Debug-iphonesimulator/Mijn Kinderen.app/Mijn Kinderen'

4

1 回答 1

1

并不是说“ extern”不好,您只需要在某个 .m 文件的顶部 声明真正的“ ”,否则该对象并没有真正分配到任何地方。NSArray

因此,如果您在 .h 文件中声明“ extern”变量,请在支持该 .h 文件的 .m 文件顶部声明真正的变量。

例如

NSArray * _products;

在“ @implementation”位之前。并确保您在 .m 文件中的某处执行分配和初始化该变量

于 2013-04-03T20:50:43.010 回答