Determining cause of cordova iOS build failure - ios

My cordova phone application is building and running well in android, and now I'd like to build for ios. I can't do this in my linux environment, so I'm using a mini-mac with the Xcode tools installed.
I cloned the git repo to a working tree, and I'm running
cordova build ios
In the build output, I'm getting the following, with "fatal error", "BUILD FAILED" and "Error: ..." in red.
/Users/mgfrobozz/Desktop/asap_cordova/platforms/ios/ASAP Media/Plugins/org.apache.cordova.dialogs/CDVNotification.m:21:9: fatal error:
'Cordova/NSDictionary+Extensions.h' file not found
I found https://issues.apache.org/jira/browse/CB-8659, which indicated this issue (deprecated dependency in ios) was resolved in cordova 4.0.0, but I'm running cordova 6.0.0.
I don't know enough about the cordova guts to know how to fix CDVNotification.
Any suggestions?

Try the command: cordova platform update ios

Related

Firebase Plugins not Working on IOS (Ionic)

I am developing an Ionic App, and I am having some issues with the IOS App and Firebase/FCM Plugins.
The Android App is working perfectly with the below plugins installed:
ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated
npm install #ionic-native/fcm
As for the IOS App I tried several Plugins and none is working:
Option 1:
ionic cordova plugin add cordova-plugin-fcm
npm install #ionic-native/fcm
The app is building successfully, but it is failing when launched on an iPhone. When debugging, I am getting this error Message:
Terminating app due to uncaught exception 'com.firebase.core', reason: 'Configuration fails. It may be caused by an invalid GOOGLE_APP_ID in GoogleService-Info.plist or set in the customized options.'
Option 2:
ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated
npm install #ionic-native/fcm
When building with this plugin, I am getting the below error in xCode:
** ARCHIVE FAILED **
The following build commands failed:
CompileC /Users/walid/Library/Developer/Xcode/DerivedData/Nutripro-aabwvacmftjwnefthwnyidfyxswx/Build/Intermediates.noindex/ArchiveIntermediates/Nutripro/IntermediateBuildFilesPath/Nutripro.build/Release-iphoneos/Nutripro.build/Objects-normal/arm64/FCMPlugin.o /Users/walid/Documents/www/nutripro/platforms/ios/Nutripro/Plugins/cordova-plugin-fcm-with-dependecy-updated/FCMPlugin.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
xcodebuild: Command failed with exit code 65
[ERROR] An error occurred while running subprocess cordova.
I searched alot to find a solution for this error, and I can't find any.
Option 3:
ionic cordova plugin add cordova-plugin-firebase
npm install #ionic-native/firebase
I can build an App successfully using this plugin, and I can run it on my iPhone and a Token is generated and I can receive Push Notifications Normally.
But the problem here is happening when Uploading the App to the App Store
Archiving on xCode is Successful
When Distributing/Uploading the App, I am getting the below Error:
ERROR ITMS-90771: "Missing Info.plist value. The Info.plist key 'BGTaskSchedulerPermittedIdentifiers' must contain a list of identifiers used to submit and handle tasks when 'UIBackgroundModes' has a value of 'processing'. For more information, refer to the Information Property List Key Reference at https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Introduction/Introduction.html."
I searched the Internet and found this article stating that I must add the below to my info.plist file
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>com.nutripro.mobile</string>
</array>
After adding it and Resubmitting my Application, I am getting an email back from Apple
Dear Developer,
We identified one or more issues with a recent delivery for your app, "NutriPro" 1.1.11 (1.1.11). Please correct the following issues, then upload again.
ITMS-90809: Deprecated API Usage - New apps that use UIWebView are no longer accepted. Instead, use WKWebView for improved security and reliability. Learn more (https://developer.apple.com/documentation/uikit/uiwebview).
Best regards,
The App Store Team
If I remove the plugin, the App is being uploaded and approved.
The weird thing is that the documentation on #ionic-native/firebase says that they got rid of the UIWebView and are using WKWebView
N.B: After Each Option, I am uninstalling the installed Package and Node Module, and I am deleting the platforms folder.
Do you guys have any idea how I can fix this issue? I've been trying to figure out a solution for almost 1 week and I can't find any!
After a lot of research and unsuccessful attempts, I found a solution.
For Android, I am using fcm-with-dependecy-updated
ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated
npm install #ionic-native/fcm
For IOS, I am using firebase-messaging
ionic cordova plugin add cordova-plugin-firebase-messaging
npm install #ionic-native/firebase-messaging
I found a solution.
rm -rf platforms/android
cordova plugin remove cordova-plugin-firebase
Install this plugin firebase-lib
For cordova-cli >= 9.x.x && (cordava-ios >= 5.0.1 || cordava-android >= 8.x.x). Use the latest major releases just by running:
cordova plugin add cordova-plugin-firebase-lib
For cordova-cli <= 8.1.1 && (cordava-ios <= 4.5.5 || cordova-android >= 8.x.x) Use the v4.x release by running:
cordova plugin add cordova-plugin-firebase-lib#4.1.0 --save
For cordova-cli <= 7.1.0 && (cordava-ios <= 4.5.5 || cordova-android <= 7.1.4). Run the following in your terminal:
cordova plugin add cordova-plugin-firebase-lib#3.3.0 --save
Androidx
cordova plugin add cordova-plugin-androidx
cordova plugin add cordova-plugin-androidx-adapter
For cocoaPods
If you are building your app using Xcode, please open platform/ios/my-cordova-project.xcworkspace instead of platform/ios/my-cordova-project.xcodeproj so that the Xcode can load both Cordova app & the Pods.
Your repo needs to be up to date. To keep it up to date, run pod repo update anywhere in your terminal.

Ionic build fails Info.plist not found

Apple has tricked me and even though I disabled autoupdates it now pulled the most recent XCode version (Version 10.0 (10A255)) and dependencies. The effect is that I can not build my app anymore, even after removing (ionic cordova platform remove ios) and re-adding the platform.
It now fails with the error below.
onic cordova run ios --debug --target="iPhone-8" --consolelogs
...
<path>/platforms/ios/build/emulator/MyApp.app/Info.plist file not found.
[ERROR] An error occurred while running cordova run ios --debug --target iPhone-8 (exit code 1).
ionic --version
3.20.0
---- EDIT
ran with verbose and received :No scripts found for hook "before_deploy". as additional info for the failure.
----- EDIT ------
Please look here for more detail. I was able to reproduce it from scratch / a blank app template
Blank app fails debug build - /Info.plist file not found
ionic cordova emulate ios -- --buildFlag="-UseModernBuildSystem=0"
Try this command it should work,this is issue with cordova.
If you're building on the command-line, try this
ionic cordova emulate ios -- --buildFlag="-UseModernBuildSystem=0"
or
Xcode 10
If you are opening the project in the Xcode IDE, you need to change the build system in Workspace Settings to "Legacy Build System"
Xcode example
Now, You can also run this on command-line $ionic cordova build ios
Best of luck

How to fix ionic 2 Apple Mach-O Linker error?

I'm building an ionic 2 app, and I can build the app with ionic build ios and I get no erros, but on xcode when I build my application I get the following error.
Apple Mach-O Linker (id) Error
Linker command failed with exit code 1 (use -v to see invocation).
How can I fix this?
Here is my system information
Cordova CLI: 6.5.0
Ionic Framework Version: 2.3.0
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.1.4
ios-deploy version: 1.9.0
OS: macOS Sierra
Node Version: v6.9.4
Xcode Version: Xcode 8.3 Build version 8E162
You are probably opening the .xcodeproj on Xcode, try opening the .xcworkspace. This fixed this error for me.
Had the same issue, spent almost a day trying to figure out what was causing it. For me the following solved it. Everything was working fine on ios#4.3.1, but on 4.5.3, I got this annoying error.
Check if this plugin "cordova-plugin-console" is there in the plugins folder. If it is there, remove it. Then it started building without any errors.
ionic cordova plugin remove cordova-plugin-console
Look for a file named libPods-AppName.a in Frameworks directory
where AppName is your app name.
Deleting it fixes it in most cases.
Take a look at the screenshot for reference.
Quick Fix
Disclaimer: My project uses Ionic v1
I had the same error and, once I had added a Android-only plugin, I thought that it was the cause of the error - I was wrong (so, ignore this cause if you think the same as I).
After some search I found the truly cause of the error: the cordova-ios version (4.5). I followed the steps suggested here and I solve this issue.
Steps:
ionic cordova platform remove ios
ionic cordova platform add ios#4.4.0
ionic cordova platform
Last step is used to check if ios#4.4.0 is actually the installed version.
Hope it helps.
In your platforms folder for ios, there are both .xcodeproj and .xcworkspace files. Open the /platforms/ios/.xcworkspace.
I found the issue that was causing this error.
On the config.xml file on the tag I had the email with my#email.com and you cannot have the .com on the email. I removed and it works fine now.
Thanks for the help

Cordova platform add IOS Cocoapods and phonegap-push-plugin error in CMD

I'm working on a Cordova app in Visual Studio 2015.
I tried to add the iOS platform to cordova by running this in cmd
C:\cordovaProjectDirectory > cordova platform add iOS
this is the error I get
cocoapods error.jpg
I have been trying to get push notifications to work on my iOS device via remote build and I suspect this might be causing the problem.
Android device is working fine
What I have tried :
removing and installing phonegap-push-plugin
removing and installing ios platform
deleting platform/ios folder and clearing cordova cache
create empty project and run same cmds
Some info :
cordova cli 6.3.1
phonegap-push-plugin 1.9.2
node 5.6.0
npm 3.6.0
Alot of the solutions I see for installing Cocoapods are for MAC Terminal.
I have no idea what I'm missing or doing wrong.
Any advice is greatly appreciated!

PhoneGap CLI "cordova build ios" failed

i have created a new hello world project using the following command,
cordova create hello com.example.hello HelloWorld
the project is created successfully, then i add the ios platform by
cordova platform add ios
and to verify i have it added correctly, i type
cordova platform list
the iOS platform is shown in the list. so at this point, according to the PhoneGap tutorial, i can use the command
cordova build ios
to build the iOS version of the project. however, i encounter the following error:
Generating config.xml from defaults for platform "ios"
Preparing ios project
Compiling app on platform "ios" via command "/Users/Aldour/PhoneGap/hello/platforms/ios/cordova/build"
/usr/local/lib/node_modules/cordova/node_modules/q/q.js:126
throw e;
^
Error: An error occurred while building the ios project.
at ChildProcess.<anonymous> (/usr/local/lib/node_modules/cordova/src/compile.js:65:22)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:735:16)
at Socket.<anonymous> (child_process.js:948:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:466:12)
the results that i have googled are mostly concerning the android version, talking about the invalid environment path setting. i dont know if it is related since i can create and build a PhoneGap project targeting the android platform without problem.
here is my $PATH:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin/node:/usr/local/bin/npm:/Developer/SDKs/android-sdk-macosx/platform-tools:/Developer/SDKs/android-sdk-macosx/tools
EDIT:
problem solved by re-installing xcode from app store
I had the same problem in Android platform, and it was solved with the commands:
cordova platform rm android
cordova platform add android
cordova build android
in Node.Js console. try it in ios.
If you get an error with 'cordova platform add android', you may need to manually remove any android folders in your project folder hierarchy.
This resolved my issue:
cordova platform remove ios
cordova platform add ios
cordova build ios
If you run the build with --verbose, you will probably see some permission issues. By default, XCode creates a folder of the build in ~/Developer, if you haven't changed it. There probably is a permissions issue when creating that folder. Just execute the following command: sudo cordova bulid ios
That should fix your issue.

Resources