Phonegap-nfc plugin causes build to fail on xcode - ios

I am using ionic 5 capacitor and i am trying to get phonegap-nfc plugin to work. It works fine on android but while building with xcode building fails.
Steps to reproduce with fresh project (selected Angular framework when it was asked):
ionic start myApp blank --capacitor
cd myApp
ionic build
ionic capacitor add ios
npx cap open ios
It opens in xcode and i can build and run project on simulator just fine. Then i install phonegap-nfc plugin:
npm install phonegap-nfc
npm install #ionic-native/nfc
ionic cap sync
When i try to build again i receive semantic issue with cordovaplugins. There are 5 errors in NfcPlugin.m file saying 'new' is unavailable with note saying 'init has been explicitly marked unavailable here. How to fix this issue?
Some version info of my system:
Xcode version: 12.5 (12E262)
macOS version: Big Sur 11.3
node version: 16.0.0 (also tried with 10.16.0)
npm version: 7.10.0
Screenshot of xcode errors

I will answer my own question as i happened to find solution. I dont what is broken in xcode 12.5, but uninstalling xcode 12.5 and installing xcode 11.7 i was able to build succesfully and scan NFC tags.

Related

IONIC 5 - InAppBrowser is not installed or you are running on a browser -XCODE 13

I have an IONIC 5 / cordova project and I use InAppBrowser to open a link.
In the next code:
const browser = this.iab.create(url);
I get error "WARN: InAppBrowser is not installed or you are running on a browser. Falling back to window.open" on execution time in IOS device and IOS emulator.
I have tried all kinds of things that I have found on the internet:
First, I have done many test with #ionic-native/in-app-browser plugin, but I always get the same result:
Remove node_modules, www, platform/ios
Re-install(remove and install) in-app-browser libraries
Recompile in dev and prod mode.
Same error..
I have tried it again with the new plugin:
$ ionic cordova plugin add cordova-plugin-inappbrowser
$ npm install #awesome-cordova-plugins/in-app-browser
I change the code to get the new native plugin
$ ionic cordova platform add ios
BUILD DEVEL and PROD
$ ionic cordova build ios
$ ionic cordova build ios --prod
Same result.
I have verified that the cordova plugins are installed in the /Plugins folder of the XCode project.
I have a couple of things to comment on:
Now I use XCode 13, but In XCode 12 works fine. To upgrade the XCode I have upgrade MacOS from Catalina To Monterey.
The only difference between the two projects is that in XCode 13 "Legacy build system" is disabled since it's "deprecated".
I don't know if XCode doesn't import the libraries, I don't know if "Legacy Build System" is necessary. I know nothing... :-(
Can anybody help me?
Thanks.
I found the problem.
In my project I have an "Object.prototype" function that it produce a big problem to loop objects.
Referring InAppBrowser pluguin, in file inappbrowser.js:
callbacks = callbacks || {};
for (var callbackName in callbacks) {
iab.addEventListener(callbackName, callbacks[callbackName]);
}
Perhaps it could be improved with an Object.keys(callbacks), but I think that It was my problem.
Thanks.

visual studio cordova ios deploy for remote build

My problem is
Severity Code Description Project File Line Suppression State
Error Remote build error from the build server http://xxxxxx:3000/cordova - Derleme, Command to fetch XCode version failed. Your build may fail if the version installed is 8.0 or greater.
My Version:
Xcode version 7.2
Cordova version 6.3.1
Node 4.4.3
Npm 2.15
Cordova android 5.2.1
Cordova iOS 4.2.0
I had same issue previously, and I resolved it by go to my mac and accept the license agreement of xcode.
Run this in terminal : sudo xcodebuild -license and then type agree.

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!

ionic build ios **export failed** error: exportArchive: Found no compatible export methds

When I run: ionic build ios the archive succeeds but the export fails.
Error Messages:
error: exportArchive: Found no compatible export methods for: DVTFilePath:0x7f9d3dc41d20:'/Users/**PATH**/platforms/ios/**PROJECTNAME**.xcarchive'
Error Domain=IDEFoundationErrorDomain Code=1 "Found no compatible export methods for: DVTFilePath:0x7f9d3dc41d20:'/Users/**PATH**/platforms/ios/**PROJECTNAME**.xcarchive'" UserInfo={NSLocalizedDescription=Found no compatible export methods for: DVTFilePath:0x7f9d3dc41d20:'/Users/**PATH**/platforms/ios/**PROJECTNAME**.xcarchive'}
Error: Error code 70 for command: xcodebuild with args: -exportArchive,-archivePath,fasTask.xcarchive,-exportOptionsPlist,/Users/**PATH**/platforms/ios/exportOptions.plist,-exportPath,/Users/**PATH**/platforms/ios/build/device
I modified the exportOptions.plist 'method' key to 'export_method' but same error message.
I tried uninstalling Xcode and re-installing. The first build after re-installation gives me a successful build. Any builds after the first build give me the same error message as before.
Also if I npm uninstall -g ionic cordova and delete everything in the platform folder, then npm install -g ionic cordova then the first build succeeds but any build after it fails.
ionic serve works fine every-time.
Details:
Xcode 7.3.1
ionic 2.1.14
cordova 6.4.0
cordova-ios 4.3.1
ios-deploy 1.9.0
Thanks.
Hey I am having the same issue, it happened after updating ionic and cordova to the lastest version. I created a new project ionic start added platform ios and when trying ionic run ios --device i got the same output that you're having after building trying to export.
When running an older (pre-update) project i was not having any problem at all after i did a ionic platform rm ios and then ionic platform add ios the problem reproduced again. I think is has to be to the way that the updated cli is adding the platform or that it is expecting an updated SDK version (Xcode 8).
A workaround is first launch and installing the app to the device using Xcode, then in the terminal do ionic run ios --device -l this will create a livereload ionic server. At the end it will show the error but the livereload server will be still working and you can develop and the changes will be reflected on the app without any problem.
Xcode: 7.3.2
Ionic: 2.1.13
Cordova: 6.4
Try
ionic build ios --emulator

Build Commands Failed Error Code 65 Ionic (iOS)

I'm using ionic to build my iOS app but im having this problem when running the command : "ionic build ios"
** BUILD FAILED **
The following build commands failed:
CompileC build/HR\ APP.build/Debug-iphonesimulator/HR\ APP.build/Objects-normal/i386/PushPlugin.o HR\ APP/Plugins/com.phonegap.plugins.PushPlugin/PushPlugin.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/user/desktop/hr/platforms/ios/cordova/build-debug.xcconfig,-project,HR APP.xcodeproj,ARCHS=i386,-target,HR APP,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/user/desktop/hr/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/user/desktop/hr/platforms/ios/build/sharedpch
Try This command
phonegap plugin remove phonegap-plugin-push
I had this same issue,
I would like to let you know my machine local environment setup-
******************************************************
Your system information:
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-beta.10
Ionic CLI Version: 2.1.8
Ionic App Lib Version: 2.1.4
ios-deploy version: Not installed
ios-sim version: 5.0.8
OS: OS X Yosemite
Node Version: v6.2.2
Xcode version: Xcode 7.2 Build version 7C68
******************************************************
It generally occurs when we took app raw code form some other machine and try to build.
When I search for that I came to know that this issue is taking place due of spaces from build path
Steps I followed-
Opened app config.xml in editor.
Renamed App name such as-
<name>Rername App Title</name>
$ cordova plugin save
$ cordova platform rm ios
$ cordova platform add ios
After this I just build the app
$ ionic build ios
And that worked for me, hope you will get your issue resolved too.
This link helped me a lot-
https://forum.ionicframework.com/t/ionic-build-ios-fails-android-works/10515/2
Note:- Make sure you have complete icon and splash of the app for each platform i.e-
ionic resources

Resources