0

I have this project with multiple iOS targets. Each target has its own AppDelegate.h and AppDelegate.m which inherits from either AppDelegateBase or AppDelegateServiceBase. I am using Xcode 13.4.1 - the build works fine but archive fails. For Xcode 12.x, this works just fine.

The moment I try to archive, it resolves to wrong header from a different target but same name and naturally gives error because of difference in imports.

Any idea how to fix this?

I use xcodebuild -project client/Onyz.xcodeproj -scheme IQW -configuration DEBUG -sdk iphoneos15.5 archive … this gives me error as the path for a file referring to AppDelegate resolves to target IMW (which is the other target). Part of logs are below. Initially this problem was extending to build command as well, but changing from -target to -scheme fixed it. This pattern of failure holds across xcodebuild and Xcode but limited to 13 and above.

In file included from /Volumes/ZX_2TB_SSD/j1/workspace/Onyz/client/iOS/WebBrowserMenuViewController.m:19: In file included from /Volumes/ZX_2TB_SSD/j1/workspace/Onyz/client/iOS/Targets/IMW/AppDelegate.h:10: In file included from /Volumes/ZX_2TB_SSD/j1/workspace/Onyz/client/iOS/AppDelegateServiceBase.h:20: In file included from /Volumes/ZX_2TB_SSD/j1/workspace/Onyz/client/iOS/SDK/AdSupport/AotAdWindow.h:10: /Volumes/ZX_2TB_SSD/j1/workspace/Onyz/client/iOS/SDK/AdSupport/AotAdNetworkManager.h:13:9: fatal error: 'GoogleMobileAds/GoogleMobileAds.h' file not found #import <GoogleMobileAds/GoogleMobileAds.h>

On 2nd line - instead of IMW, it should be IQW and after that the rest of header resolution chain will change.

  • Check for the include path in target settings. – Ptit Xav Oct 27 '22 at 13:13
  • They are same as other targets – TheButlerDidIt Oct 27 '22 at 13:59
  • Does this answer your question? ["GoogleMobileAds/GoogleMobileAds.h" file not found error](https://stackoverflow.com/questions/28777884/googlemobileads-googlemobileads-h-file-not-found-error) – Ptit Xav Oct 27 '22 at 16:12
  • That's not the issue... It shouldn't resolve to IMW/AppDelegate.h . Instead, it should resolve to IQW/AppDelegate.h as I am trying to build target IQW – TheButlerDidIt Oct 28 '22 at 14:36
  • What about [this](https://stackoverflow.com/questions/14900696/two-targets-two-header-files-with-the-same-name-how-to-use-each-header-for-the) – Ptit Xav Oct 29 '22 at 08:51
  • I tried this... seemed plausible but sadly didn't help. I don't understand how it's working alright for Xcode 12.x – TheButlerDidIt Oct 31 '22 at 04:49
  • If you do not share the AppDelegate.h between apps you try to rename them as IQWAppDelegate.h so your are sure to load the correct one. (No need to rename the class). (If I understand) your other classes use only AppDelegate(Service)Base so should not be affected. It is only a workaround, but it may help. – Ptit Xav Oct 31 '22 at 08:08
  • There's a lot more files in the codebase , that import "AppDelegate.h" - and cause every target has its own AppDelegate - this header resolution helps out a lot – TheButlerDidIt Nov 01 '22 at 13:08
  • Somehow, just rearranging the target folder order worked. I have no explanation why... xcode works in mysterious(read dumb) ways. – TheButlerDidIt Nov 07 '22 at 15:25

0 Answers0