Building Realm for Mac Catalyst fails: Realm.h not found - ios

I have an iOS app, which I recently updated to support Mac Catalyst. For the Mac version I added a new target, which I also added to my Podfile with the subset of the same libraries, including Realm.
The app builds well for "My Mac", but when I want to archive it (build for release), it fails with the following error:
"Umbrella header 'Realm.h' not found"
I am not familiar with the problem, what could go wrong?
I tried the usual Derived Data deleting, etc, but nothing seems to help. Is this some kind of problem with the CocoaPods, my config, or with Realm?

Due to CocoaPods not releasing 1.10.2 I have fixed the same issue in my project.
Remove Realm from your pod file
pod install in terminal to remove it fully
Install Swift Package Manager for (Xcode) - https://swiftpackageregistry.com/realm/realm-cocoa
This should allow you to get the project archived successfully.

Related

xcode build not compiling due to pods unity-iphone-framework.sh line 42 source: unbound variable

Basically, I made a game on unity and then when I built it for Xcode it showed up this error after I updated the pods file and excluded the arm64 architecture, can someone please guide me on how to fix this error
I have already tried on m1 mac and an intel based mac but the same problem occurs I have reinstalled pods and also have rebuilt the project but nothing seems to work
Upgrade all Pods to the latest version available.
Delete the "VALID_ARCHS" from build settings and user define settings

'FBSDKShareKit/FBSDKShareKit.h' file not found

I've made an IOS build on Unity for an App we're making after adding the facebook SDK, moved the build on a hard drive and tried to build it on xcode on the mac we have at the office, as I always do before uploading it to the app store. I ran into this error and I've been stuck on this issue for 2 full work days and it's driving me a bit crazy, here are the thing's I've tried:
-Install cocoapods, both on the default terminal directory and on the project's directory (I'm not too experienced with cocoapods so I don't know if that made a difference. I also did pod update while standing on the project directory).
-I saw that the IOS resolver has an option called "generate pod files" that people said needed to be checked when building to solve this issue. It was checked by default on my project, so that wasn't it.
-Added the framework path on the build settings to where the facebook SDK is at (though the way it looked on my xcode seemed a bit different than the way I've seen it on other people's xcode screenshots)
-Tried commenting out some #include lines on the headers that are generating the issue. It only produced more errors.
-People said to open the project from the workspace instead of the xcodeproject but unity doesn't seem to generate a workspace file.
-Tried downgrading the Facebook SDK to a previous version but the versions people claim are working don't seem to be on the repository anymore, so it doesn't let me downgrade to them.
At the moment I'm trying to make it work with the latest Facebook SDK which is 9.0.0.
Any help would be appreciated, please let me know if I'm not being specific enough about the issue or if there's any information about my project I should include on the post
The .xcworkspace should be created by Cocoapods, not by Unity directly.
If you already have the Podfile generated, just run pod install on the project directory and open the created .xcworkspace file after Cocoapods finishes installing the external dependencies.

Migrating from Cocoapods to Swift Package Manager but import module failed

recently I'm refactoring a project which uses Cocoapods to manage dependencies (a lot of dependencies...), since Xcode 11 integrated Swift Package Manager, I want to migrate progressively some dependencies to SPM staring from the framework Alamofire.
After I removed the Alamofire from the Podfile (delete and run pod install) and added it into SPM,
I got the error No such module 'Alamofire'.
I've already tried to clean build and removed derived data but none of them can fix it.
Did anyone have this problem too?
After few days searching, I found out this https://stackoverflow.com/a/57312755/863020.
Seems that SPM could be only used for Debug and Release configurations, if we want to use it with more configurations then we should write a pre-action. And it is also a known issue on Xcode so I would not use SPM for now :(
UPDATED on dec. 12
So I come back to my question after the new release of Xcode 11.3, it fixed this issue and now I can build the project with custom build configuration :)

Module compiled with Swift 4.2.1 cannot be imported by the Swift 5.0 compiler

I am trying to implement integration of third party app into project as per instruciton https://github.com/Paytm-Payments/Paytm_iOS_App_Kit/tree/master/Swift/BitCodeDisabled/PaytmNativeSDK
I see the following error in build
Module compiled with Swift 4.2.1 cannot be imported by the Swift 5.0
compiler
I have tried toolchains https://medium.com/xcblog/switching-swift-versions-inside-xcode-using-toolchains-755b28831c43
The error changes to Reason: Incompatible library version: PaytmNativeSDK requires version 1.0.0 or later, but libswiftCore.dylib provides version 0.0.0
How do i setup XCode or the Library to make it work . There is no chance of the vendor updating the library for Swift 5.0 and make it available on POD.
For Carthage users: After upgrading to Xcode 10.2, I ran into this same issue with a framework that I had been importing using Carthage.
I resolved it by rebuilding the framework:
carthage update --no-use-binaries --platform iOS
The correct solution is download Xcode 10.1, and wait for Apple patch the bug fix.
Don't waste time on fix third-party bug.
The problem of my project is we are using Alamofire which is failed to update by Carthage.
The provider of this library should rebuild it with BUILD_LIBRARY_FOR_DISTRIBUTION = YES; (available in Xcode 11.3 in Build Settings -> Build Options). Already asked to do it in the corresponding GitHub issue. After that PaytmNativeSDK will be compatible with every next Swift version.
It looks like the issue has been fixed in 804152caae76245d96548eb74ea87a6150239407.
I wanted to use Swift 4.2 (which Xcode 10.2 should still support, I've set it in Swift Language Version), but it still gave me an error about the Swift 5.0 compiler. So after trying to clear everything like build folder, derived data and stuff, I came to the conclusion that it does not work on Xcode 10.2.
I reverted back to Xcode 10.1 which you can download here. This works. So until Apple fixes this bug I am forced to stay on Xcode 10.1.
The developers of the framework need to provide an update, which is built in Xcode 10.2.
Explanation for framework developers:
Even if you created the framework in Xcode 10.2 or with the default version used by CI, your users may still encounter such an error. You should make sure that Xcode 10.2 is your default command line tool. You can check it in terminal with the command xcodebuild -version.
Default version can be adjusted in Xcode -> Preferences -> Locations -> Command Line Tools.
This will happen if you have external libraries in your project thats still built using 4.2 compiler, whereas the new Xcode tries building your project in 5.0 compiler.
In my case, I had few libraries imported using Carthage. Luckily the libraries that I have used have released an updates in the past few days making it compatible with Swift 5.0 compilers. If those external libraries haven't updated it to support Swift 5.0 you may be out of luck for now.
On the way you might still face few issues and here are some best practices to avoid further issues.
Remove the cartfile.resolved and Carthage folder completely
Ensure you remove any copy of the libraries added to your project earlier.
Remove the embedded libraries and Linked frameworks and libraries from your Targets> Yourapp > General .
Product > Clean build folder
Update the Cart file and fetch the new sources using the Carthage update command
Now import the libraries back to your project.
Hopefully it works.
My problem with Carthage was related to the xcode phase that copys binaries in
"carthage copy-frameworks" phase.
I've a slightly different solution to the one commented in https://stackoverflow.com/a/55362536/721929, because that solution also updates dependencies versions in some cases.
So, I just executed "carthage build". I also include a cache clean for Carthage, to fix possible errors in subtasks (in my case, failing in git clone with "exit code 1")
rm -rf ~/Library/Caches/org.carthage.CarthageKit
carthage build --no-use-binaries --platform iOS --verbose
Just remove all the *.framework folders, fetch and generate then just Import the new framework folders to your project.
That's what helped me.
For Instance:

Zip and Encryption pods build error in Ensembles 2.6.2

I created a brand new Xcode project in Swift and integrated Ensembles 2.6.2 via Cocoapods.
I also wanted to include Zip compression and Encryption and so I simply added these 2 pods in my Podfile, as suggested in the manual.
Unfortunately after running pod install, I’m getting an error when trying to build. I attach 2 screenshots to give you some context. Unless I’m missing something really obvious, I have no idea on what to try next.
I'm using Xcode 9.4.1 and macOS 10.13.6

Resources