0
votes

I could use some help on the following errors I keep getting when trying to run my project.

My project is already published with an In App Purchase. In my newest version I try to incorporate IAP in another view controller but when I want to run I get two Apple Mach-O Linker Error and a Dsymutil Error as well.

I may have updated Xcode(to Version 4.6 (4H127)) since my last published version, but I'm not sure.

Some things I've checked already:

  • Link Binary With Binaries still seems to include all neccessary frameworks;
  • Compile Sources seems to include all my .m files;
  • I can't find the __products anywhere in my code (_products I can find thoug...: I made a global variable with that name (was a local variable before))
  • I tried running on simulator and a device as well.

Global variable is declared in .h file which is imported in view controller in which it is needed: extern NSArray *_products;

I'm not sure of my external frameworks/libraries can cause any trouble. They worked fine before: TestFlight, Appirater, CHCSVParser.

The errors:

Ld "/Users/jaspervandermaarel/Library/Developer/Xcode/DerivedData/Mijn_Kinderen-dglsdifvjduysjbpixoiuyaekgky/Build/Products/Debug-iphonesimulator/Mijn Kinderen.app/Mijn Kinderen" normal 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/Platforms/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"

Undefined symbols for architecture i386: "__products", referenced from: -[MKGebeurtenissenViewController voegToeGebeurtenis:] in MKGebeurtenissenViewController.o -[MKGebeurtenissenViewController alertView:clickedButtonAtIndex:] in MKGebeurtenissenViewController.o -[MKKinderenViewController alertView:clickedButtonAtIndex:] in MKKinderenViewController.o -[MKKinderenViewController productPurchased:] in MKKinderenViewController.o -[MKKinderenViewController voegKindToe:] in MKKinderenViewController.o -[MKGebeurtenissenViewController voegToeGebeurtenis:] in MKGebeurtenissenViewController.o -[MKGebeurtenissenViewController alertView:clickedButtonAtIndex:] in MKGebeurtenissenViewController.o -[MKKinderenViewController alertView:clickedButtonAtIndex:] in MKKinderenViewController.o -[MKKinderenViewController productPurchased:] in MKKinderenViewController.o -[MKKinderenViewController voegKindToe:] in MKKinderenViewController.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

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"

error: unable to open executable '/Users/jaspervandermaarel/Library/Developer/Xcode/DerivedData/Mijn_Kinderen-dglsdifvjduysjbpixoiuyaekgky/Build/Products/Debug-iphonesimulator/Mijn Kinderen.app/Mijn Kinderen'

1
can you edit your question to show how the global variable "_products" is declared? hopefully it's not just an "extern".Michael Dautermann
I'm afraid it is, see my edit. Is this bad?user1492198

1 Answers

1
votes

It's not that "extern" is bad, you just need to declare the real "NSArray" at the top of some .m file somewhere otherwise the object hasn't really been allocated anywhere.

So if you declare your "extern" variable in a .h file, declare the real variable at the top of the .m file that supports that .h file.

E.G.

NSArray * _products;

before the "@implementation" bit. And make sure you do alloc & init that variable somewhere in your .m file.