Hello,
I have built a simple app with NativeScript and am trying to run it on my connected iPhone. However, I am very new at this and not sure what I am doing wrong.
I am able to run the app on an emulator, but every time I enter:
tns run ios --device
I get the output:
Searching for devices...
Your application will be deployed only on the device specified by the provided index or identifier.
Skipping prepare.
Building project...
Unable to apply changes on device: f120788f0909e611439e12bf9ae575c5ab18a7b1. Error is: ENOENT: no such file or directory, scandir '/Users/charlesdupont/Library/MobileDevice/Provisioning Profiles/'.
What should I do??
@cadupont23
IThere are few things, that needs to be considered.
If you want to run your project on the specific connected device, you need to provide the ID. Get the id by listing all connected devices
tns devices
and then using the ID of the device you want to deploy on run the following command
tns run ios --device <device-id-here>
However, keep in mind that to deploy and run on a real iOS device, the provision profiles and development certificates should be set. Once all is done, the application can be deployed on real device using provision flag or by setting TEAM_ID in the build.xcconfig file located in app/App_Resoirces/ios
e.g.
tns run ios --provision <profivions>

This is what I get when I enter: tns run ios --device <device-id-here>
I'm not sure I fully understand how to set the provision profiles and development certificates.. Where do I find the profivions ?
Is there no way to run the app on my phone, without having to set up an App ID and registering and all of that?
@cadupont23 run
tns run ios --device '<device-id-here>' --clean
I came here because of the same error message, but with a different problem:
I wanted to run my NativeScript app on my phone after developing it using the simulator.
When running tns device ios --available-devices I found my connected device.
When running tns run ios --device <my-device-id> I got the same error: Unable to apply changes on device....
To debug the connection between my computer and my device, I started a new empty iOS project in Xcode.
When trying to run the empty project on my device, I got an error message stating that I should accept the developer profile in the settings app on my iPhone.
After going to the settings and accepting the developer profile, I was able to run the empty iOS project from Xcode.
I then ran the tns run command again, resulting in a new error:
I needed to update "nativescript": {"id": "org.nativescript.application"} in package.json to match the package name in my provisioning profile.
I then ran tns run ios --device <my-device-id> again and everyting worked beautifully! 馃コ
鈿狅笍 Please note: All necessary certificates and provisioning profiles should be in place for these steps to work.
I also got:
Unable to apply changes on device: 00008030-001660E00C50402E. Error is: ENOENT: no such file or directory, scandir '/Users/tomasbjerre/Library/MobileDevice/Provisioning Profiles/'.
Fixed it with:
mkdir -p '/Users/tomasbjerre/Library/MobileDevice/Provisioning Profiles/'
Now I get another error from:
tns run ios
...
error: There are no accounts registered with Xcode. Add your developer account to Xcode (in target 'XXX' from project 'XXX')
error: No profiles for 'se.YYY.app' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'se.YYY.app'. (in target 'XXX' from project 'XXX')
I found these:
https://developer.apple.com/forums/thread/47806
https://help.apple.com/developer-account/#/devbfa00fef7
https://developer.apple.com/forums/thread/86161
I started XCode, went to Preferences and added my account.
I go to XCode > Preferences > Accounts. select Download Manual Profiles.
Now:
tns run ios
...
Warning: unable to build chain to self-signed root for signer "Apple Development: Tomas Bjerre (XXXXX)"
...
I think the solution was to open platforms/ios/XXX.xcodeproj in XCode.
Mark project in left explorer.
Going to "Signing and Capabilities" in main view.
There I found a "fix issue" button... clicked that and it did... something.
After that when I run tns run ios I am asked for my login password and app deploys to iphone.
Most helpful comment
I came here because of the same error message, but with a different problem:
The problem
I wanted to run my NativeScript app on my phone after developing it using the simulator.
When running
tns device ios --available-devicesI found my connected device.When running
tns run ios --device <my-device-id>I got the same error:Unable to apply changes on device....The solution
To debug the connection between my computer and my device, I started a new empty iOS project in Xcode.
When trying to run the empty project on my device, I got an error message stating that I should accept the developer profile in the settings app on my iPhone.
After going to the settings and accepting the developer profile, I was able to run the empty iOS project from Xcode.
I then ran the tns run command again, resulting in a new error:
I needed to update
"nativescript": {"id": "org.nativescript.application"}in package.json to match the package name in my provisioning profile.I then ran
tns run ios --device <my-device-id>again and everyting worked beautifully! 馃コ鈿狅笍 Please note: All necessary certificates and provisioning profiles should be in place for these steps to work.