Ionic Xcode build, Apple Mach-O Linker Error - ios

I know this has been posted about a million times but I still can't figure out what's going on.
This is an Ionic 3 project that already works and builds fine on Android. I am now trying to build it for iOS and I'm getting this error when building in Xcode. I already checked my Link Binary With Libraries build phase and there are no pod files in there. Also I am in the .xcworkspace file, not the .xcodeproj.
Apple Mach-O Linker Error
Linker command failed with exit code 1
When I build using ionic cordova build ios I get an error code 65 for build command xcodebuild.
Edit: After some more digging I think I found a more specific error, Framework not found FileProvider for architecture x86_64.

I would like to give an alternative here. That is you can use Ionic Package service.
Ionic Packages makes it easy to build a native binary of your app in
the cloud. Perfect for developers using Windows that want to build iOS
apps.
This lets you:
Send your packaged app to others
Build your app for platforms not supported by your computer (e.g. iOS
builds on Windows)
Build .ipa and .apk files that you can submit to app stores

Related

Unable to build HERE SDK Premium for ios-arm64-simulator

Having trouble building HERE SDK for iOS (Premium 3.19) for an ios-arm64-simulator. The error produced by Xcode 13 on an M1 pro processor is:
ld: building for iOS Simulator, but linking in dylib built for iOS, file 'Pods/HEREMaps/framework/NMAKit.xcframework/ios-arm64/NMAKit.framework/NMAKit'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
After some research and testing it looks like HERE SDK's XCFramework folder as well as the Cocoapod configuration only include ios-arm64 and ios-x86_64-simulator. It looks like the podspec is attempting to fix this by overriding the target app's iOS simulator excluded architectures (adding excluded architecture "arm64"). This likely works fine in cases where only Cocoapod sourced libraries that include x86_64 are used in the target app. However, it's a problem when using libraries from other sources where there is no roll back option to x86_64 simulators (e.g. Swift Package Manager).
Is there a way to use lipo to generate ios-arm64-simulator from the two existing framework builds? Or is this something where ios-arm64-simulator needs to be built as another configuration from the HERE SDK source?
Let me tell you that we have already located this situation in the SDK and our team in charge of the SDK is working very hard to provide a solution to this problem in the next release of HERE SDK Premium.

Error building for iOS simulator in hybrid app

I've been struggling with an error building my app with ionic and cordova.
Everything started when I tried a "ionic cordova build ios --prod --release". It retrieved an error regarding FirebaseAnalytics for architecture arm64
"clang: error: linker command failed with exit code 1"
Reinstalling the pods and removing and adding the ios platform again I got this error even without the --release flag.
error: Building for iOS Simulator, but the embedded framework 'WebRTC.framework' was built for iOS. (in target 'Qvadis' from project 'Qvadis')
and I'm stuck here and I don't know if something changed with the latest XCode version (12.0) or the latest iOS version (14) or I have a dependencies problem.
Before that, it compiled just fine.
Thank you in advance,
Borja.
I found a solution:
In Build Settings, selecting your app as Target, you have to type "arm64" in "Excluded architectures".
However, this doesn't allow you to archive and publish it so you have to remove the "arm64" excluded architecture to perform those actions.
I don't know if this is a good approach, but this is the one that works for me.

When publishing a project (swift 4.2) in the AppStore, an error occurs when linking the libPrinterSDK library.a

All kind time of day. The project on Swift uses the SDK for blueTouth printer Mini Thermal Printer POS-5805DD. The libPrinterSDK library (included with the printer) has been added to the root of the project.a and the PrinterSDK header file.h, header-file is connected via bridge, when you run the project on a real device-everything works correctly, no errors occur. But when you try to build a project to upload to the AppStore, at the very end when linovke libprintersdk library.a an error appears:
ld: bitcode bundle could not be generated because
'/Users/ivan/Documents/MyProject/PrinterSDK/libPrinterSDK.a
(GCDAsyncSocket.o)' was built without full bitcode. All object files
and libraries for bitcode must be generated from Xcode Archive or
Install build file
'/Users/ivan/Documents/MyProject/PrinterSDK/libPrinterSDK.a' for
architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
If there is any experience of building a project with libPrinterSDK files.a and PrinterSDK.h, I would really appreciate any help. Thanks.
Im not sure your project has turn Enable Bitcode off yet, if not, try to set No like this image below and Archive project again.
If it doesn't work, you can refer here

Can't build app for iOS devices with Ionic 3

I'm developing an app for android and iOS.
I'm using firebase to receive push notifications. When I build for Android, it works fine, but no luck with iOS.
I followed a tutorial for firebase, put the GoogleService.plist on resources folder. I've created the authentication key on Apple Developer Website. I have a paid Apple developer account.
I used cocoapods to install dependencies of the project.
But, when I run, using the Xcode 10, I got this error:
Plugins/cordova-plugin-firebase/Protobuf.framework/Protobuf(Wrappers.pbobjc.o)
ld: 585 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Anyone have the same issue?
Thanks
Make sure you're using the following command to build:
Development
ionic cordova build ios -- --buildFlag="-UseModernBuildSystem=0"
Production
ionic cordova build ios --prod --release -- --buildFlag="-UseModernBuildSystem=0"
as discussed by the ionic dev team, the new build system of xcode is not supported yet, then you should use the older one.
When opening the project in Xcode, if you're using a plugin that use cocoa pods as dependence manager, Google Maps is a example, you should open the ProjectName.xcworkspace file instead of ProjectName.xcodeproj as the xcworkpace knows how to compile a cocoa pods plugin dependece based.
ionic cordova build ios --prod --buildFlag='-UseModernBuildSystem=0'
Just as a side note that you will stumble upon, XCODE exposes a Signing bug, so untick the “Automatically manage signing” and tick again in XCODE.

Xcode - clang failed with exit code 1. Plugin cause?

I'm getting an odd error in Xcode when I try to Archive my app.
I'm using Ionic and the Ionic CLI tools. The app has been built for Android and is in beta on the Google Play store.
In Xcode I get this error:
clang: error: no such file or directory: '/Users/SubjectiveEffect/myApp/platforms/ios/CardsApp/Plugins/de.appplant.cordova.plugin.email-composer/APPEmailComposer.m'
clang: error: no input files
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
So it looks like there is some error with the de.appplant email plugin. The email plugin works in Android but it doesn't work in Ionic View on iOS. I wasn't sure if this was that the plugin isn't Ionic View compatible or not.
Anyone have any ideas?
Upate:
I uninstalled this plugin and I now get the same error, but from a different plugin!
clang: error: no such file or directory: '/Users/SubjectiveEffect/myApp/platforms/ios/CardsApp/Plugins/com.danielcwilson.plugins.googleanalytics/UniversalAnalyticsPlugin.m'
clang: error: no input files
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
So I'm pretty sure this is a plugin problem.
Anyone have any idea why or how I can fix it? I'm installing from the command line on a Mac with the standard cordova commands as seen on ngCordova.
edit: To be clear - those folders do not, indeed, exist. The plugins work fine in Android though...
Your error is quite strange, probably something happened to the structure folders..
I would try doing something like this:
Before doing this test make a backup copy of platforms/ios.
cd my-folder-app/
ionic platform remove ios
ionic platform add ios
Now should need to copy from backup and paste for example the icons, splash screens to the fresh platforms/ios folder and re-apply some eventual changes that you did.
ionic build ios
And then open xcode:
Run the app on emulator or device to test if works
Disconnect the device
Select the schema and iOS Device
If you need configure the schema, first you need to edit it:
Select Archive from the left panel, and from the right there is Build Configuration: select Release if you want publish the app or Debug if you want install the app on a test device. And click Close.
From the top menu: Product > Archive
Good luck!
UPDATE:
To be sure that your errors not depends to the ionic project make this test please:
cd projects-folder/
ionic start myTestApp tabs
cd myTestApp/
ionic platform add ios
ionic build ios
And now follow the same steps on xcode to archive the app.
I never really found out what was happening.
What I did was remove the iOS platform and re-add it. This just created more errors although for some reason the correct folders were there. I also then found my Android build wouldn't work.
I removed everything and re-added it all, updating Ionic too.
Then XCode would open but freeze. Hard freeze. The only way to quit it was to force close the Mac. I even uninstalled XCode and re-installed it. Same thing.
Finally I used the command line to erase all presets in XCode so it would open fresh without any projects loaded. Now it works, and the Android version seems to be working too.
I've no idea where the error started and so I can't rightly tag anyone as correct as that would be misleading. The solution: cleans and burn, start again. :)

Resources