iOS Build crashing dyld: Symbol not found

Hey!

I’m building my first game for iOS using Unity. I’ve made and published a few games on Android. iOS is a little trickier, it seems. I generated the xCode project, build it, and it builds fine and then immediately crashes on the simulator.

I have both GoogleMobileAds and GooglePlayGames in the project. The logs read this message:

dyld: Symbol not found: _OBJC_CLASS_$_GSDK_GTMSessionFetcher
  Referenced from: /Users/slashg0/Library/Developer/CoreSimulator/Devices/FC590B60-F039-47F4-B81E-EF4A99D619D7/data/Containers/Bundle/Application/45238C77-AE2D-4BB5-A98D-F5AE734201E9/auradefence.app/auradefence
  Expected in: flat namespace
 in /Users/slashg0/Library/Developer/CoreSimulator/Devices/FC590B60-F039-47F4-B81E-EF4A99D619D7/data/Containers/Bundle/Application/45238C77-AE2D-4BB5-A98D-F5AE734201E9/auradefence.app/auradefence
(lldb) 

I have followed a lot of threads with similar issues

  • I’ve tried pod install manually, building from the .xcworkspace file (which isn’t generated by default)
  • I’ve deleted pods, then installed them manually
  • I’ve tried copying GoogleOpenSource and a few other libraries, they cause build errors.

I may be overdoing the wrong things here. Can anyone point out what I need to do?

*[EDIT 1] Adding the Unity generated Podfile: *

source 'https://github.com/CocoaPods/Specs.git'
install! 'cocoapods', :integrate_targets => false
platform :ios, '82'

target 'Unity-iPhone' do
pod 'Google-Mobile-Ads-SDK', '~> 7.13'
pod 'GooglePlayGames', '~> 5.0'
end

I am using the .xcodeproj to open and build the game, I don’t have an .xcworkspace file.

this is your problem.
when you do pod install, it says very clearly that you need to use the workspace, not the project. it’s not joking.

The problem is that when I open this .xcworspace file and build it from there, I get several ‘not found’ errors. I have also tried to find which files (or classes?) are missing and adding their pods. I reached a point where I was getting a ‘not found’ error for some files I couldn’t find the pods for.

those problems need to be fixed. if you’re using pods, you need to use the workspace.

Hi, I’ve had the same issue and managed to solve it.

I’m assuming you are trying to run the app on the simulator. The error “Expected in: flat namespace” is given when the library you are using is not available for simulator. Explained here.

So change the player setting for Target SDK under Other Settings to Device SDK, then run the Unity build.

Once you have the xCode project. The project will not build I’ve no idea why to solve that,

  1. Delete everything that is related to Cocoa Pods Podfile Podfile.lock and Pods folder
  2. Create a clean PodFile (See the example below.) Need to add GoogleSignIn separately since GooglePlayGames is not referencing it correctly. You can read it more here.
  3. run pod install
  4. From other linker flags under Build Settings remove -Obj C
  5. Build xCode project and run it on a real device.
    source 'https://github.com/CocoaPods/Specs.git'
    platform :ios, '9.0'
    
    target 'Unity-iPhone' do
        pod 'GooglePlayGames', '5.0'
        pod 'GoogleSignIn', '4.0.0'
    end
    
    post_install do |installer|
      installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings['ENABLE_BITCODE'] = 'NO'
        end
      end
    end