Ed S
Ed S

Reputation: 105

How to get app running on connected device

I'm trying to get a simple NativeScript app running on my device (iPhone) connected to my mac. The simple app works fine on the simulator, but fails when a device is connected. (Its the HelloWorld app from the tutorial.)

When running "tns run ios" from my mac, I get the following error:

Unable to apply changes on device: . Error is: ENOENT: no such file or directory, scandir '/Users/edscott/Library/MobileDevice/Provisioning Profiles/'.

I also tried installing Sidekick and using it to auto generate the Provisioning Profile and Certificate. It successfully generated the provisioning profile and certificate. (I did not change any configuration in my app, if I needed to point something at these files or copy them somewhere, I did not. Maybe that is the issue?)

From SideKick, when selecting my connected device, setting the Build Type to Local and the Build Configuration to either Debug or Release, and then clicking "Run on Device", I get a very similar error:

Error detected during LiveSync on for /Users/edscott/HelloWorld. Error: ENOENT: no such file or directory, scandir '/Users/edscott/Library/MobileDevice/Provisioning Profiles/'.

The only change I made to the app was to change the package.json file and set the nativescript.id value to a unique app id.

FYI...The provisioning profile and certificate created by SideKick were placed in /Users/edscott/Library/Application Support/NativeScriptSidekick/CodeSigning/HelloWorld/ios directory.

Also, I created a new apple id to use with SideKick. The apple id I use on both my phone and mac has 2FA and apparently SideKick can not generate provisioning profile and certificates for apple ids with 2FA.

I plan to experiment with using NativeScript to build an ios app that reads data from iBeacons. Therefore, running on the device is critical for me (as opposed to running on the simulator).

I'm looking for help in what to try next.

Update: Based on the comment added below, I opened the provision.mobileprovision file that was created by SideKick using Xcode - this created a provisioning profile in '/Users/edscott/Library/MobileDevice/Provisioning Profiles/'. However, I was still not able to run the app on my device. I'm now getting the following error:

Unable to apply changes on device: xxxx. Error is: Command xcodebuild failed with exit code 70.

In addition, there are multiple errors reported about the following: Error Domain=IDECodesignResolverErrorDomain Code=1 "No signing certificate "iOS Distribution" found"

However, based on some other similar issues posted online, I tried running the app in Xcode directly, and that worked (after I turned off debug execution based on another online comment associated with XCode 10).

So now, I have a way to run the app, but it won't run from the CLI or SideKick app, it will only run in Xcode.

Upvotes: 1

Views: 1537

Answers (2)

Ed S
Ed S

Reputation: 105

The comment from Manoj, ultimately solved this problem. Therefore, I'm adding it here as the answer:

Double click the Provisional Profile and open it with Xcode, it will automatically copy the Provisional Profile to the library folder.

Initially, I had to use Xcode to run this on my device. However, after restarting NativeScript Sidekick, I was able to run this app on my attached device using NativeScript Sidekick.

Upvotes: 0

alex_z
alex_z

Reputation: 436

If you want to run your applications on iOS devices you need to specify valid Certificates and Mobile Provision as mentioned here (which you get I think from Apple developers account):

There are a lot of similarities between Build and Run on Device. For example, you still need to provide a valid certificate and mobile provision to deploy your app on an iOS device. To avoid repetition with the previous chapter, we will focus only on the specific requirements needed to run your app on a device.

The only prerequisite to run your app on a device is to have one connected to your machine. You also need to verify that the device is detected in Sidekick. The Devices pane provides information about all connected devices and their current state - reachable or not. To open the Devices pane, click on the Devices button in the bottom right corner of the client.

This is not required on simulators. However, if you want to create a demo that you could showcase on an iOS device, it`s better yo use Nativescript Playground.

Upvotes: 1

Related Questions