Search code examples
iosxcodeipadcocoapods

Undefined symbols for architecture i386, only on iPad simulator


There is a framework imported via CocoaPods named JPush in my project.

Everything was just fine on iPhone device and iPhone Simulator. But the complier kept complaining the following when I switched to iPad simulator (I didn't try it on iPad devices because I didn't have any iPad with me).

enter image description here

I gathered all iOS devices architecture

arm64:iPhone6s | iphone6s plus|iPhone6| iPhone6 plus|iPhone5S | iPad Air| iPad mini2(iPad mini with Retina Display)
armv7s:iPhone5|iPhone5C|iPad4(iPad with Retina Display)
armv7:iPhone4|iPhone4S|iPad|iPad2|iPad3(The New iPad)|iPad mini|iPod Touch 3G|iPod Touch4

32-bits processor:
simulator: i386
real device: armv7 or armv7s
64-bits processor: 
simulator: x86_64
real device: arm64

So when you come up with the same error, try use file FILENAME command to show what architecture your static lib supports.


Solution

  • The framework you're trying to link against doesn't include an i386 slice:

    libjpush-ios-3.0.9.a: Mach-O universal binary with 4 architectures: [arm_v7:current ar archive] [arm64]
    libjpush-ios-3.0.9.a (for architecture armv7):  current ar archive
    libjpush-ios-3.0.9.a (for architecture armv7s): current ar archive
    libjpush-ios-3.0.9.a (for architecture x86_64): current ar archive random library
    libjpush-ios-3.0.9.a (for architecture arm64):  current ar archive
    

    It does include an x86_64 slice, though. Select a 64-bit iOS device for simulation (iPhone 5S or later) and rebuild.