Firebase Plugins not Working on IOS (Ionic) - ios

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.

Related

Error on running a Ionic 3 App in Xcode "Property 'isPairedWatchExist' not found on object of type 'AppDelegate"

I'm trying to run a app build on Ionic 3 on Xcode.
The app was running fine o Xcode in June when I have made and publish i Apple Store.
Now when I try to run the app on Xcode I receive this error "Property 'isPairedWatchExist' not found on object of type 'AppDelegate".
I receive the error from a file called CDVAppleWallet.m coming from the plugin cordova-apple-wallet that we use in application
https://imgur.com/7mxAR85
I have tried to:
run npm install;
uninstall the cordova apple wallet plugin and install it again;
event the plugin is uninstalled we receive the error;
I have deleted all the plugins and node modules and reinstall them again.
I had this too, and I did a few things but not sure which ones solved it:
Removed platform, and re-added ios
ionic cordova platform rm ios
ionic cordova platform add ios
Fixed signing in Xcode, exited
Did a build in CLI
ionic cordova build ios --prod --release
Opened Xcode again, clicked "Clean Build Folder"
The error disappeared after that

ionic 4 ios fails to build due to swift version 3

After upgrading to xcode 10.2 my ionic for ios project stopped building using below command
ionic cordova build ios -- --buildFlag="-UseModernBuildSystem=0"
i tried to upgrade cordova-ios#5.0.0 and remove and readd ios platform but no luck.
The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. Supported values are: 4.0, 4.2, 5.0. This setting can be set in the build settings editor.
Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 12.2'
** ARCHIVE FAILED **
The following build commands failed:
Check dependencies
(1 failure)
xcodebuild: Command failed with exit code 65
[ERROR] An error occurred while running subprocess cordova.
cordova build ios --buildFlag=-UseModernBuildSystem=0 exited with exit code 65.
Re-running this command with the --verbose flag may provide more information.
I ran into the same error. I first tried to switch the Swift Language version in the Xcode build setting and quickly realized that some plugins written in Swift broke. Thankfully the plugin which broke for me was QR Scanner which is well maintained and has been updated for Swift 5.
So what I did to fix it was first run the following node commands to find and update the outdated node packages.
npm outdated
npm update
Then I identified the outdated/broken cordova plugins, removed them, then reinstalled the latest versions. Using
cordova plugin list
to make sure everything was updating correctly, cross referencing with the version numbers with the plugins repo. Then finally I added this to the config.xml
<preference name="UseSwiftLanguageVersion" value="5" />
and everything built successfully when running,
ionic cordova build ios -- --buildFlag="-UseModernBuildSystem=0"
Unfortunately, if you're using a cordova plugin that is written in Swift and is not well maintained you're out of luck. You can try to update the plugin yourself if you're brave.
Hopefully this was helpful and doesn't require you to role back your Xcode, losing the ability to build for the latest version of iOs.
You should go with below steps-
Open your project in Xcode by click on workspace file in platforms >> ios >> PROJECT_NAME.xcworkspace
Go for Build Settings
Now search "Swift Language Version"
Change the version to 4 or 5(whichever required)
run below command
Ionic cordova build ios --buildFlag="-UseModernBuildSystem=0"
Just add this plugin
cordova plugin add cordova-plugin-add-swift-support --save
Or if you already added then just remove this plugin and add again.

IOS build fails for MFP Cordova-Ionic project

I am trying to build my MFP cordova Ionic based hybrid application created using CLI. It works perfect for android but it fails when I try to build it for iOS. There are multiple errors which I am facing
xcodebuild[14887:399060] [MT] PluginLoading: Required plug-in compatibility UUID 7FDF5C7A-131F-4ABB-9EDC-8C5F8F0B8A90 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/VVDocumenter-Xcode.xcplugin' not present in DVTPlugInCompatibilityUUIDs
I tried resolving this issue by adding required missing key-val in plist file
When I try to run it from Xcode I am getting error - Some keys are missing in worklight.plist
After adding missing keys now I am getting
2016-05-04 17:50:28.507 StoreApp[14787:396490] [FATAL] [WL_INIT] -[WLImpl initWL] in WLImpl.m:180 :: Init failure: Can't read checksum.js, The operation couldn’t be completed. (Cocoa error 258.), (null). Reinstall the application and try again.
Even I have tried running simple MFP cordova project,but build fails for this
Even I have tried running simple MFP cordova project,but build fails for this
I cannot reproduce this...
idanadar#mbp-idan:~/Desktop$ mfp cordova create
? Enter name of app: myapp
? Enter the package ID: com.ibm.myapp
? Enter the app version: 1.0.0
? Select platforms to be supported by your app: ios
? The following plugins will be automatically added to your app:
cordova-plugin-mfp
org.apache.cordova.device
org.apache.cordova.dialogs
org.apache.cordova.geolocation
org.apache.cordova.globalization
org.apache.cordova.inappbrowser
org.apache.cordova.network-information
Please press enter to continue...
? Select additional plugins you would like to add:
? Enter a path to an app template to be added: cordova-hello-world-mfp
Embedded Cordova Command: cordova create "myapp" "com.ibm.myapp" "myapp" --copy-from="/Applications/IBM/MobileFirst-CLI/mobilefirst-cli/node_modules/cordovacmd/cordova/templates/cordova-hello-world-mfp"
Adding ios project...
Adding "cordova-plugin-mfp"
Installing "cordova-plugin-mfp" for ios
Installing "org.apache.cordova.device" for ios
Installing "org.apache.cordova.dialogs" for ios
Installing "org.apache.cordova.geolocation" for ios
Installing "org.apache.cordova.globalization" for ios
Installing "org.apache.cordova.inappbrowser" for ios
Installing "org.apache.cordova.network-information" for ios
Plugin install completed
If you made changes to your main.m file, please manually merge main.m.bak with MFP's main.m
Plugin "cordova-plugin-mfp" added successfully.
Preparing for push...
MFP App settings not found, configuring..
Embedded Cordova Command: cordova prepare ios
/Users/idanadar/Desktop/myapp/mobilefirst/com_ibm_myapp-iphone-1.0.0.wlapp has been built.
Push Completed Successfully.
MFP Cordova project created successfully.
idanadar#mbp-idan:~/Desktop$ cd myapp/
idanadar#mbp-idan:~/Desktop/myapp$ mfp cordova run --platform ios
The iOS Simulator then started and the application was displayed.
As for creating an Ionic-based app using MFP Cordova, I suggest that you will follow this: https://www.raymondcamden.com/2015/03/23/working-with-ibm-mobilefirst-and-the-ionic-framework/

Determining cause of cordova iOS build failure

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

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