75

This error occur only when I try to cordova run ios --device

Even after cordova build ios command executed, non error is reported.

Whats I do wrong? And how to debug cordova projects on my iPhone (need this because need to test a Camera feature)

WITH CONFIGURATION Debug ===

Check dependencies
Code Sign error: No provisioning profiles found: No non–expired provisioning profiles were found.

** BUILD FAILED **


The following build commands failed:
        Check dependencies
(1 failure)
Error code 65 for command: xcodebuild with args: -xcconfig,/Users/ridermansb/Projects/jdapp/platforms/ios/cordova/build-debug.xcconfig,-project,CorrijaMe.xcodeproj,ARCHS=armv7 armv7s arm64,-target,CorrijaMe,-configuration,Debug,-sdk,iphoneos,build,VALID_ARCHS=armv7 armv7s arm64,CONFIGURATION_BUILD_DIR=/Users/ridermansb/Projects/jdapp/platforms/ios/build/device,SHARED_PRECOMPS_DIR=/Users/ridermansb/Projects/jdapp/platforms/ios/build/sharedpch
ERROR running one or more of the platforms: Error: /Users/ridermansb/Projects/jdapp/platforms/ios/cordova/run: Command failed with exit code 2
You may not have the required environment or OS to run this project
ridermansb
  • 10,779
  • 24
  • 115
  • 226
  • Here is the solution guys !!! https://stackoverflow.com/questions/36095819/cordova-ios-error-building-images-xcassets/36968113#36968113 – gtzinos Sep 30 '16 at 12:45

15 Answers15

59

You need a development provisioning profile on your build machine. Apps can run on the simulator without a profile, but they are required to run on an actual device.

If you open the project in Xcode, it may automatically set up provisioning for you. Otherwise you will have to create go to the iOS Dev Center and create a profile.

Connor Pearson
  • 63,902
  • 28
  • 145
  • 142
50

Try to remove and add ios again

ionic cordova platform remove ios

ionic cordova platform add ios

Worked in my case

Christian
  • 148
  • 8
Shashank Saxena
  • 2,014
  • 17
  • 11
25

I had the same problem. In my case cordova platform update ios helped. The reason was in outdated version.

Khrystyna Skvarok
  • 1,198
  • 13
  • 15
  • 1
    Thanks Khrystyna Skvarok! This helped when adding and removing the platform alone didn't work. It seems the ios version is not explicitly updated when you run `platform remove ios` and `platform add ios` – Eric Kigathi Oct 27 '16 at 02:26
  • 1
    `cordova platform update android||ios` is no longer supported. You need to do `cordova platform remove android||ios` then `cordova platform add android||ios` – Jim Bergman Jan 23 '19 at 18:12
25

I was getting the same error when I tried to do :

cordova build ios

except mine said ** ARCHIVE FAILED ** rather than ** BUILD FAILED **.

I fixed it by opening the projectName.xcodeproj file in Xcode and then adjusting these 2 settings :

  1. In Targets > General > Signing ensure you have selected a Team

enter image description here

  1. In Targets > Build Settings > (search for "bitcode") set Enable Bitcode to "Yes"

enter image description here

Then I quit out of Xcode and reran cordova build ios and it worked.

Jim Bergman
  • 5,207
  • 2
  • 17
  • 19
kris
  • 11,868
  • 9
  • 88
  • 110
  • Note that I then needed to change the Enable Bitcode setting back to "No" to get it to run from Xcode, but I still think that step was necessary to fix the cordova build issue. – kris Feb 28 '17 at 08:41
  • 1
    All I had to do was open it in XCode and set up provisioning profile. Didn't need to enable bitcode. – Phil Mitchell May 15 '17 at 20:41
  • 1
    Future visitors: `Archive failed` means there is a signature related problem i.e. no provisioning profile. Open Xcode and select a team and Xcode will generate/find a provisioning profile for you. – Abdul Sadik Yalcin Jan 22 '18 at 16:56
10

Open xCode can be exhausting if you do it everytime, so you need to add this flag :

  • cordova build ios --buildFlag="-UseModernBuildSystem=0"

OR if you have build.json file at the root of your project, you must add this lines:

 {
  "ios": {
    "debug": {
      "buildFlag": [
        "-UseModernBuildSystem=0"
      ]
    },
    "release": {
      "buildFlag": [
        "-UseModernBuildSystem=0"
      ]
    }
  }
}

Hope this will help in the future

Nizar
  • 1,172
  • 7
  • 10
4

I tried a few things in this scenario.

I removed ios and installed many times. Went down the path of deleting Splash screens to no avail! Bitcode on/off so many times.

However, after selecting a iOS provisioning team, and running pod update inside ./platforms/ios, I am pleased to announce this resolved my problems.

Hopefully you can try the same and get some resolution?

stemount
  • 41
  • 2
4

In my case it was the app icon PNG file... I mean, it took 1 day to go from the provided error

Error code 65 for command: xcodebuild with args:

to the human-readable one:

"the PNG file icon is no good for the picky Apple Xcode"

Gianluca Ghettini
  • 11,129
  • 19
  • 93
  • 159
  • 2
    Any hint on how to move from the cryptic cordova error to a more closer to the reality one? Any tutorial or guide? – ciaoben Dec 10 '18 at 14:52
2

I must add :

I had the same problem, it was coming from the fact that my teammate had a different version of cordova, and commited plugins on the repo with his version.

For all cordova plugins, I had to :

cordova plugin rm <plugin-name> 
cordova plugin add <plugin-name>

And ask my teammate to update his cordova to match my version

Vincent Wasteels
  • 1,568
  • 2
  • 14
  • 21
2

1) Open code in Xcode 2) Continue with : ionic cordova build ios

Alexan
  • 8,165
  • 14
  • 74
  • 101
Ankit
  • 45
  • 2
2

Same problem for me today, with "ARCHIVE FAILED". None of the solutions above worked for me, but watching closer, the error refers the path of module cordova-plugin-inappbrowser, so i removed the plugin, then added it again, and it finally works...

ionic cordova plugin remove cordova-plugin-inappbrowser
ionic cordova plugin add cordova-plugin-inappbrowser

stack :

Ionic cli 6.2.2
Ionic1 1.3.2
Cordova cli 9.0.0
Cordova platform ios 5.1.1
cordova-plugin-inappbrowser 3.2.0
Nicoz
  • 71
  • 7
2

Error code 65 can also show up, if you have something (like your device) plugged into the computer, while building.

Lirianna
  • 330
  • 1
  • 13
1

How to do what @connor said:

iOS

  • Open platforms/ios on XCode
  • Find & Replace io.ionic.starter in all files for a unique identifier
  • Click the project to open settings
  • Signing > Select a team
  • Go to your device Settings > General > DeviceManagement
    • Trust your account/team
  • ionic cordova run ios --device --livereload
BrunoLM
  • 97,872
  • 84
  • 296
  • 452
0

For me it was the cordova-plugin-ionic-webview so did the below which worked for me after trying anything else:

cordova plugin remove cordova-plugin-ionic-webview
cordova plugin add cordova-plugin-ionic-webview

Found it on xCode after trying to rebuild failed build from:

ionic cordova build ios 
Sabri Aziri
  • 4,084
  • 5
  • 30
  • 45
0

Here is what helped me

STEP 1 (build.xcconfig)

// xcode 13
EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64=arm64 arm64e armv7 armv7s armv6 armv8
EXCLUDED_ARCHS=$(inherited)
$(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT))

IPHONEOS_DEPLOYMENT_TARGET = 12.0

STEP 2 (Podfile)

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
      config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
      config.build_settings['CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER'] ='NO'
      config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
    end
  end
end

IPHONEOS_DEPLOYMENT_TARGET = 12.0
0

If you are trying to change the app icon and you get this error then you should have a picture with larger dimensions like 180x180.

Niqusor31
  • 33
  • 7