12

I am trying to build my iOS/iPadOS project on my mac using the new Mac Catalyst. When I build it on the simulator for iPhone everything is fine but when I build it on my Mac, I get this error.

in /Users/nevin/Documents/[projectName]/Pods/Crashlytics/iOS/Crashlytics.framework/Crashlytics(CLSInternalReport.o), building for Mac Catalyst, but linking in object file built for iOS Simulator, file '/Users/nevin/Documents/[projectName]/Pods/Crashlytics/iOS/Crashlytics.framework/Crashlytics' for architecture x86_64

This happens for multiple pods so if I remove Crashlytics for example, I get a similar error for another pod. Does anybody know if this is something that Crashlytics needs to fix or is it something that I can fix within my project?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Nevin Jethmalani
  • 2,726
  • 4
  • 23
  • 58
  • Not (yet) working with Catalyst, but it really does seem you need separate builds - one for iOS and one for macOS. Please, NOT separate projects, code, etc. separate builds. –  Oct 30 '19 at 21:47
  • How do we create a separate build for macOS? We just click run and then select macOS instead of iOS? – Nevin Jethmalani Oct 30 '19 at 21:49
  • I honestly don't know, just trying to help. I never really had a need for conditional builds in Xcode, but know *some* of what you can do with Schemes 7 Build Settings.It's obvious the *cause* of your issue - iOS versus macOs - but the *solution8? I don't think you should create an actual macOS fork.... –  Oct 30 '19 at 21:55

1 Answers1

2

Mac Catalyst uses x86_64 but compiled with a target for Mac Catalyst.

I have a project that compiles for Mac Catalyst, you need to add these flags: https://github.com/ezored/conan-darwin-toolchain/blob/stable/1.1.0/conanfile.py#L183-L188

If your frameworks are not compatible, don't link it in "General > Frameworks", but select "iOS" instead of "macOS + iOS". Example:

xcode

And in your swift code add IF code to check if your framework can be imported and used with this:

#if targetEnvironment(macCatalyst)
    print("UIKit running on macOS")
#else
    print("Your regular code")
#endif

With this, you can make apps compatible with Mac Catalyst. And when your frameworks (like Crashlytics) be compatible check "macOS + iOS" again and remove check on code.

Another option is to make another target for Mac Catalyst and put only things for Mac Catalyst, but with my first option, you can build without problems.

And if you want to make frameworks with Mac Catalyst support with C++ code you can check my framework (https://github.com/ezored/ezored).

Paulo Coutinho
  • 705
  • 1
  • 7
  • 15