NativeScript cannot launch iOS emulator - nativescript

Emulator started when I run ns run ios However, app cannot be deployed with the following error:
Unable to apply changes on device: D2B97EAA-B6DB-4920-8974-4F615FEB4E82. Error is: Command xcrun with arguments simctl install D2B97EAA-B6DB-4920-8974-4F615FEB4E82 /Users/cupidchan/Documents/GitHub/pistevo-health/NativeScript/platforms/ios/build/Debug-iphonesimulator/NativeScript.app failed with exit code 1. Error output:
An error was encountered processing the command (domain=IXUserPresentableErrorDomain, code=1):
Unable To Install “NativeScript”
Please try again later.
The parent bundle has the same identifier (org.nativescript.NativeScript) as sub-bundle at /Users/cupidchan/Library/Developer/CoreSimulator/Devices/D2B97EAA-B6DB-4920-8974-4F615FEB4E82/data/Library/Caches/com.apple.mobile.installd.staging/temp.ammMqk/extracted/NativeScript.app/Frameworks/NativeScript.framework
Underlying error (domain=MIInstallerErrorDomain, code=57):
The parent bundle has the same identifier (org.nativescript.NativeScript) as sub-bundle at /Users/cupidchan/Library/Developer/CoreSimulator/Devices/D2B97EAA-B6DB-4920-8974-4F615FEB4E82/data/Library/Caches/com.apple.mobile.installd.staging/temp.ammMqk/extracted/NativeScript.app/Frameworks/NativeScript.framework
Environment
NativeScript: 8.0.1,
Xcode: 12.4,
iOS 14.4

I have found out that this is because of the appid of the NativeScript. When I created the application using ns create myapp, I didn't specify --appid parameter. Hence NativeScript created one for me. However, you can change this id in ./nativescript.config.ts After you name with something unique to your app, it can start the emulator correctly.

Related

WatchKit 2.0 app's bundle ID person.bundle.Ropes.watchkitapp is not prefixed by the parent app's bundle ID followed by a '.'; expected prefix

When I use bundle id named like bellow. I have that error
(My app bundle: ilyabiryuk.bundle.Ropes)
But if I rename bundle like .watchkitapp It starts perfectly on simulator but give an error when I start it on my real watch(Series 3 42mm, watchOS 8.7.1)
How to fix that?
(IDE: Xcode 14 beta 6 (14A5294g))
In the watch app info.plist, make sure the entry WKCompanionAppBundleIdentifier is present and that its value is the bundle ID of the iOS app.
Bundle IDs should be as following:
iPhone app bundle ID: com.myname.myapp
Watch app bundle ID: .watchkitapp
Watch extension bundle ID: .watchkitapp.watchkitextension
Note that Watch app and extension DOES NOT have parent application and start by a point (ie. relative bundle ID).
For anyone tried all answers above. Here is what I got that finally worked:
Clean Build Folder
Add your iOS app bundle to WKCompanionAppBundleIdentifier
Your simulator will scream that provisioning failed, ignored it.
Add your iOS app bundle to the Watch's Build Identifier field.
Your simulator will scream that .watchkit 2.0 error and still will not
work. Ignore it.
Save and close Xcode
Relaunch Xcode, and then build.
Worked for me with steps above.

Xcode 13 Debug-iphonesimulator/YogaKit/YogaKit.modulemap not found for a brand new project just initialized

A brand new React Native 0.66 app was created with command below:
npx react-native init myapp
The app was launched successfully with npx react-native run-ios. In Xcode 13, the myapp.xcodeproj is opened to test if the build will pass. To my surprise, build throws the error below:
fatal error: module map file '/Users/macair/Library/Developer/Xcode/DerivedData/xyz_app6-gpxsmunajzbqoualaavtsfpnerep/Build/Products/Debug-iphonesimulator/YogaKit/YogaKit.modulemap' not found
What is wrong here? I haven't put any code into the app and it is all React Native generated code. Xcode becomes beast by itself even though the React Native app itself runs fine. That's why the app has to be rebuilt.
This seems to be a common problem. The solution works here is just open the myapp.xcworkspace in Xcode instead of myapp.xcodeproj. The build upon workspace went through without any error.

React Native App throwing domain=FBSOpenApplicationServiceErrorDomain, code=3 Error

I've updated quite a few NPM packages in my React Native app and now even though it seems to build fine, it starts and immediately crashes on the iOS simulator. The error that it throws is:
Failed to launch the app on simulator, An error was encountered
processing the command (domain=FBSOpenApplicationServiceErrorDomain,
code=3) The request to open "org.reactjs.native.example.myappname"
failed. THe process did launch, but has since exited or crashed.
Prior to these npm package updates, the app was running fine. I found a few suggestions such as running rm -rf ios/build, cleaning the project, etc. I tried all these but still getting the same error.
Any suggestions on how to fix this issue?
BTW, this is a react-native: "^0.65.1" app and the Xcode version is 12.4.
If there is no recent change in the iOS project files then try:
Reset Content and Settings of the simulator:
If reseting the simulator content and settings doesn't work, update Xcode to its latest version.
I encountered this while upgrading a React Native application and found the actual error a few lines above:
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22): Failed to install the requested application The application's Info.plist does not contain a valid CFBundleShortVersionString. Ensure your bundle contains a valid CFBundleShortVersionString.
Then a few lines later error Failed to launch the app on simulator, An error was encountered processing the command (domain=FBSOpenApplicationServiceErrorDomain, code=4):
Fixing the above error by setting the version correctly in xcode fixed the error for me.
The error was thrown in my case because of the bundle id was copy pasted to xCode and it had space around:
" com.your.app "
instead of
"com.your.app"
In my case the problem was for xml formatter and when I formatted the file it was added " " before package name.
check the source after formatting the file.

Build to iOS Device: DTDeviceKit: deviceType from <DEVICEID> was NULL

New project in Appcelerator Studio builds and compiles to simulator with no problem. Choosing an iOS device to build it do presents an error after invoking xcodebuild.
I've downloaded the Geocoder-Sample project from Appcelerator and it compiles and sends to the same device no problem.
There is no code done. I'm using the stock template from a new project creation and trying to send it to the iPhone.
The error being shown:
[ERROR] : 2019-06-08 09:29:00.360 xcodebuild[5225:52111] DTDeviceKit: deviceType from 5bf3c1e2f2cc885d5f3db33825847fab3e4f80b6 was NULL
[ERROR] : 2019-06-08 09:29:00.361 xcodebuild[5225:52111] DTDeviceKit: deviceType from 5bf3c1e2f2cc885d5f3db33825847fab3e4f80b6 was NULL
I'm using a correct provisioning profile and developer certificate.
We got this problem in Flutter after updating XCode. We've solved it executing:
flutter clean
Flutter- In my case, I have deleted the previous build with same bundle Id.
I used react-native run-ios --device <device name> from the command line and encountered this error. It turned out that I had no Apple Developer account added in Xcode, and there was no message about it when building from a shell. I went to Xcode > Preferences... > Accounts and added one.
Then Xcode suggested adding my phone as a device for development to my Apple Developer account. After doing so, errors disappeared, and an app got installed on the iPhone.
I had the same error and was able to fix it by running a build in Xcode and then trusting the developer on the device (iOS > Settings > General > Profiles & Device Management).
If not, try to switch to enable the legacy build system in the xcode workspace.
In my case I was import GoogleMaps in AppDelegate.swift, after delete plugin I missed to delete import it from AppDelegate.swift file,
After delete imports project work will...
I met this error after update Xcode. I solved it by changing the Build System to Legacy Build System.
If you run ionic cordova run ios --list and you see undefined then most likely it's iTunes' Sync over Wi-Fi. Go to iTunes and turn that off then reconnect your device. You should now only see one device which won't be undefined.

Can't find React native project on iOS Simulator or Xcode project

I have deleted my project on Xcode may it be .xcworkspace or .xcodeproj.
Because of that, I had to delete IOS and android folders while downgrading, updating and re-upgrading my react version to re-install IOS and android folders.
Thanks to that the emulator is working but unfortunately the project isn't present in the emulator and is still absent with Xcode. One thing to point out is that the simulator only appears when ran in the integrated terminal and nor in general terminal after cd-ing in the project folder.
Can anyone please help re-integrating the project in the emulator and on Xcode, please.
Here is the error when the emulator is running in a general terminal:
Here is the error when the emulator is running in a general terminal:
error Command failed: xcrun instruments -s
xcrun: error: Failed to determine realpath of '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk' (errno=No such file or directory)
xcrun: error: unable to find utility "instruments", not a developer tool or in PATH
Here is the error for building the project within emulator when ran from VS code integrated terminal:
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening project.xcodeproj
The process you need to follow is so similar to renaming a react native app. Basically you just need to run react-native upgrade in your root project directory. For further info you can check another question here. The instructions below explains how to create another react native project based on a copied one with a new name.
First copy the directory which your to-be-name-changed application exists. And go to your newly cloned directory.
Change the name at index.ios/android.js file which is given as a parameter to AppRegistry.
Change the name and version accordingly on package.json
Delete /ios and /android folders which are remaining from your older app.
Run $react-native upgrade to generate /ios and /android folders again.
Run $react-native link for any native dependency.
Finally run $react-native run-ios or anything you want.
Courtesy of
https://stackoverflow.com/questions/42506068/how-can-i-regenerate-ios-folder-in-react-native-project

Resources