How to get app running on connected device - ios

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.

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.

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.

Related

Xamarin Deploying iOS App Ad Hoc Failing to Install

I am trying to deploy an iOS app Ad Hoc to an iPhone for beta testing. I've been developing the app on Windows VS, I have a Macbook air with all the necessary software (Xcode, VS, etc), and I have paired to it with VS on my Windows machine. I have also followed the following steps:
Created an Apple Developer account
Created an App ID with the bundle identifier as the same exact one as the one in info.plist
Created a signing certificate using my Macbook Air, downloaded it, and installed it into XCode
Created a provisioning profile with the App ID and the certificate, and made sure to include the device that I want to load the app onto.
Made sure everything above was set to "distribution" and "ad hoc" as needed.
Set Bundle Signing in my iOS project properties to Manual Provisioning, and selected the Signing Identity and Provisioning Profile to the ones that I created for this deployment.
Set the build to Release and the target to Remote Device
Ensured that the deployment target in info.plist was set to the highest available, which is 15.4, though my iPhone is at 15.6 (could this be the problem?)
Set the IPA Packaging Options to "Build iTunes Package Archive (IPA)"
Set "Include iTunesArtwork images and the iTunesMetadata.plist" to true in the same area
Successfully built the iOS project and produced a .ipa file
After all that, I've been trying to get the .ipa onto my phone, which is definitely the device I added to the provisioning profile.
I've tried two methods to do this, and both have failed:
Connecting my phone to my Windows machine and opening iTunes. Dragging the .ipa file onto the device. The app shows up on my phone, but when I try to open it, I get this error:
"This app could not be installed because its integrity could not be verified". Though it should have been.. The device is linked to the provisioning profile that was used to create the darn thing.
Connected my phone to my Macbook Air and accessed the device through XCode > Window > Devices and Simulators. I emailed myself the .ipa file and downloaded it onto the machine (the Microsoft docs explicitly state that emailing the .ipa should work just fine). In the "Intalled apps" section of the device, I clicked the little '+' and then pointed it to the downloaded .ipa. After a few seconds, it pops up an alert window that says "Unable to install *.iOS".
Other things I have tried since this has been a problem:
Recreating the above steps by re-registering my device, creating new certificates, downloading, installing, all that business.
Messing with the deployment target version.
Jumping out from behind the couch and startling it to make it do what it's supposed to.
I swear I'm done with Xamarin forever after this problem is solved, but all the headaches I've experienced have made me think twice about whether to even bother with .NET Maui haha thanks for any help you can provide
Firstly, the error This app could not be installed because its integrity could not be verified" may be caused by the proper certificate or the test devices are not visible in 'Devices' (UDIDs added) in developer.apple.com/account.I found two simialr issues, you can refer to them: link1, link2.
Secondly, have you follow this docs on how to generate the IPA file?

iOS AdHoc app works perfectly in simulator, refuses to launch on device

The app, which is for personal use, has worked perfectly for one year on my device.
Suddenly it stopped working. It would show the startup image briefly, and then quit immediately. That didn't surprise me, because the same thing happened with my other app, as my provisioning profile was expired. On the other app, I fixed it by rebuilding the app in Xcode, and it worked again. On the app that doesn't work, I can build it with Xcode and run in the simulator only, but if I try to run it on the device, either via Xcode or by archiving and exporting, the same thing happens: Launch image shown briefly, then it quits immediately. Xcode gives this error message:
Unable to launch /private/var/containers/Bundle/Application/AD405D63-426C-401B-8678-726D60BCB6F8/QuickDict.app
I have not been able to find any more diagnostics information. I notice that for my other app, the one that worked, Xcode uses a provisioning profile with a full app identifier, as in "com.domain.AppName", whereas for the app that doesn't work, it uses a profile with a wildcard app identifier. However, I need no capabilities for this one app that I know of. I let Xcode handle signing automatically.
On the device, the app won't run neither when launching via Xcode nor when trying to install the app via iTunes.
Xcode version: 8.3.3 (8E3004b)
Deployment target: iPhone iOS 9.2
Device: iPhone 5s
It is not guaranteed that the reason has to do with provisioning profiles, because some code has been changed after it was last deployed. However, it works perfectly in the simulator.
EDIT: I saw that my app was set up to run with release build in Xcode. I tried running the debug build instead, and got a new equally "informative" error message:
Could not launch "QuickDict"
process launch failed: Unspecified
EDIT2: In this case I had a different domain name available, and was able to get the app to work simply by changing the (domain name in the) app identifier. Clearly Xcode had an expired provisioning profile in the system which it insisted on using. This is not an ideal solution for others, so I will not write it as an answer, although the problem now no longer exists for me.
You have chosen adhoc based provisioning profile ,you have to choose development based provisioning profile .
Go to developer.apple and download your app development provisioning profile then choose in Xcode build setting -> code signing tab then launch I am sure you will able to launch your app as well.
Thanks.

Unable to install iOS app locally on phone after moving to distribution stage

I have recently switched my app from the development to the distribution stage, but now I'm unable to install the app from Xcode to my test phone directly. The simulators work but I need to test this on an actual device, and testflight just takes too long for what I want to test.
When attempting to install the app to my phone via Xcode, I get this error
Failed to code sign <App Name>.
None of the valid provisioning profiles include the devices: <device name>
However, this device is set up on my developer account with the correct UDID and everything.
I'm wondering if its still possible to install my app directly from Xcode onto my device, and how to do so if possible.
Thanks!
Thanks to #Darklex, it turned out that under the build settings in my target application, I had somehow managed to change the code signing identity to iOS Distribution when I needed it as iOS Development.

Unable to Download App + App is No Longer Available

We have an app that was distributed using Enterprise Distribution Profile. Now, the same app is working for some but others are reporting the following issues.
Existing/Installed app throws this error, and doesn't open:
{App Name} Is No Longer Available
Users who try to download the app from the Enterprise link are reporting this error:
Unable to Download App - {App Name} could not be installed at this time.
Done Retry
Users running iOS 8.4.1 are specifically reporting these issues. I regenerated the profile and rebuild the app. This seems to have fixed the issue for some users, but not for all.
What's the real problem here? Thoughts?
Most common causes of this issue:
URL in the plist that references the ipa is invalid.
Device storage is full
The provisioning profile is a developer provisioning profile
The ad hoc distribution provisioning profile is corrupted and the device is having an issue with it.
The device was restored from a backup and is causing a conflict for over-the-air distribution
There was a network timeout
Architecture settings of the build and the device are incompatible (can sometimes happen when "Build Active Architecture Only" is on when
building).
Not Using Mobile Safari.
To find out the exact cause of this issue:
Connect the device to your Mac.
In Xcode, open the Devices window.
Choose your device from list on the left.
View the console for the device.
Now install the app it will show the exact cause of problem
My guess, since it is only happening on some device, is that you could be using a developer provisioning profile, or maybe you are building for only one architecture, so it will only work on some devices that match the built architecture.
Please look at the device console during an install attempt to get a detailed error that should point you down the correct path for a fix.
I have the same problem.
We have found a temporary solution.
To install beta builds we are installing our apps via itunes and an ipa file

loading... application installation on iPad got stuck

We are new to iOS development and this is our first application for iPad that we are developing for our organization.
We have developed app in Xcode 4.1 with iOS SDK 4.3.2 .
We have created provisioning profile and added 4 iPad device UDIDs in the profile.
We have created app.ipa file and kept it on our internal webserver ( along with app.plist ). Then we have created simple html file which contains pointer to app.plist.
We try to install the app on the device by accessing the html file URL through safari. However the application gets stuck in "loading... " state and after long time it gives error unable to download the application. We have checked the network connectivity , the webserver logs and everything seems to be fine.
Another odd behaviour we have observed is that while the application installation is in loading state and we connect the iPad to the development machine. When itunes prompts for syncing the device we cancel the sync. Then we disconnect the cable and connect and again when it prompts for syncing we again cancel it. At this time the application gets installted. But this is happens on only one iPad. On 2 other iPads it doesn't get installed and stays in loading state. On one iPad it got installed without issues.
We are now stuck because we have to distribute this application to many users in our organization and not able to do so.
You could check the following
The provisioning file is for ad hoc distribution
The provisioning file is selected in the Code signing Identity -> Release section of the build settings of your project
You selected Product -> Archive, then pressed "Share" when the Organizer window opens.
Next step: make sure the provision file is selected
Next step: Select "Save for Enterprise Distribution". The application URL has to be the exact web address on the ipa file
You can find more detail about the process in this article
Thanks all for your answers which pointed to many useful resources for us newbie developers.
I found the cause of my problem. The device requires to connect to apple sites to verify the certificate. Since the device was in our internal wireless network and I had removed proxy settings from the device it was not able to connect. Once I gave the proxy settings it installed without problems. One point to be noted though was it was not working with proxy authentication enabled hence I had to enable IP address based access for the device.
Thanks once again for you responses.
You have problem with your provisioning profile.
The problem is that you don't sign app properly and iOS5 has changed notification that app cannot be installed with loading message only, on iOS4 it was message and app would be deleted from springboard.
You need to set in project properties under build settings code signing identity on the ad-hoc certificate that you have created. When you build app for archive sign it again like you did before with the same certificate and then try to install on device.
I use beta builder for creating index, plist and other files for web server, but you can use whatever you like.
http://www.hanchorllc.com/2010/08/24/introducing-ios-beta-builder/

Resources