iOS simulator linker command failed

2019-08-08 19:12发布

问题:

I am trying to launch my iOS app on the simulator but it does not work. Running the app on the phone works normally though. It has something to do with my admon integration. Before the simulator was running smoothly. I am using Xcode 6.1.

I added all required frameworks:

AdSupport  
AudioToolbox  
AVFoundation  
CoreGraphics  
CoreTelephony  
EventKit
EventKitUI 
MessageUI
StoreKit
SystemConfiguration
as well as libGoogleAdMobAds.a

The error I get is:

ld: warning: ignoring file /Users/XXXXXXX/Documents/app1/app1/AdSupport.framework/AdSupport, missing required architecture i386 in file /Users/XXXXXXX/Documents/app1/app1/AdSupport.framework/AdSupport (3 slices)
Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_ASIdentifierManager", referenced from:
      objc-class-ref in libGoogleAdMobAds.a(GADDevice.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

回答1:

Go to "info" in project settings and clear library search paths, and then re-add the libGoogleAdMobAds.a framework



回答2:

The library most probably does not contains any i386 binary slice. It probably contains slices for devices -- 3 "iPhone" architectures: armv7, armv7s, arm64 -- but not the simulator architecture, which runs on your computer. Since the binary slice can't be found, the linker is missing symbols to make the i386 executable, and it can't be run in the simulator.



回答3:

Where did you get the AdSupport.framework from? I now realize it's in your Documents directory.

Normally you should link the target from Xcode, by going in the target settings:

then Build phases > Link binary with libraries:

search for "AdSupport", it should be under iOS8.1:

the library should be there: