Ionic 3/Cordova: app runs via Ionic CLI but not through Xcode (build in Xcode succeeds) - ios

I'm working on an Ionic 3 project which currently runs fine on a connected iOS device (with the ionic cordova run ios --device command), and builds both with the Ionic CLI and in Xcode.
However, when I attempt to run on my device through Xcode, it hangs on the startup screen and I see the below error(s) in the Xcode console. This behavior also occurs on the beta build I currently have on TestFlight- so I don't think it's restricted to my environment.
2017-08-11 10:42:15.996743-0400 MyApp[11551:3839240] libMobileGestalt MobileGestaltSupport.m:153: pid 11551 (MyApp) does not have sandbox access for <deviceID?> and IS NOT appropriately entitled
2017-08-11 10:42:15.996819-0400 MyApp[11551:3839240] libMobileGestalt MobileGestalt.c:550: no access to InverseDeviceID (see <rdar://problem/11744455>)
This error brings up a lot of results on Google and StackOverflow, but I haven't been able to find a resolution. There is a recent SO question with an answer specifically related to Ionic, but the step there (running npm install) didn't help
It seems to be related to plugins in the project & perhaps their permissions, however I want to be clear that I've setup the App ID on the Apple Developer site properly, enabled Push Services for both Dev and Distribution, and associated the App ID to a Dev Provisioning Profile and a Distribution Provisioning Profile.
I have this developer account associated to Xcode, and am signing the build with the account that has the App ID and other setup I just described. Push notifications (and everything else) work fine for me when running on my dev device.
My hunch is this is somehow related to the Push plugin I'm using in combination with a build/project option, but I do have the APS entitlement in my project config, as well as the Push Capability set to ON in the project.
The error message itself references an OpenRadar issue, but nothing on that page really helps. I took a look at my Info.plist file as one user mentioned, but I can't find any settings that might be related to this issue. There is an App Transport Security Settings dictionary with allowed domains, however I don't see how that'd be the issue because I can't even run on my dev device which is in the allowed domains.
I'm using Xcode 8.3.3 and attempting to build to a device on iOS 10.3. My Ionic info and package.json:
cli packages: (/Users/david/Source/sideline-app/node_modules)
#ionic/cli-plugin-cordova : 1.6.2
#ionic/cli-plugin-ionic-angular : 1.4.1
#ionic/cli-utils : 1.7.0
ionic (Ionic CLI) : 3.7.0
global packages:
Cordova CLI : 7.0.1
local packages:
#ionic/app-scripts : 2.1.3
Cordova Platforms : ios 4.4.0
Ionic Framework : ionic-angular 3.6.0
System:
Android SDK Tools : 25.2.5
Node : v7.4.0
OS : macOS Sierra
Xcode : Xcode 8.3.3 Build version 8E3004b
ios-deploy : 1.9.1
ios-sim : 6.0.0
npm : 4.0.5
package.json
{
"name": "MyApp",
"version": "0.0.1",
"author": "AppAuthor",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"#angular/common": "4.1.3",
"#angular/compiler": "4.1.3",
"#angular/compiler-cli": "4.1.3",
"#angular/core": "4.1.3",
"#angular/forms": "4.1.0",
"#angular/http": "4.1.0",
"#angular/platform-browser": "4.1.0",
"#angular/platform-browser-dynamic": "4.1.0",
"#angular/tsc-wrapped": "^4.3.4",
"#ionic-native/contacts": "^4.1.0",
"#ionic-native/core": "3.7.0",
"#ionic-native/facebook": "^4.1.0",
"#ionic-native/keyboard": "^4.1.0",
"#ionic-native/mixpanel": "^4.1.0",
"#ionic-native/push": "^4.1.0",
"#ionic-native/social-sharing": "^4.1.0",
"#ionic-native/splash-screen": "3.7.0",
"#ionic-native/status-bar": "3.7.0",
"#ionic/app-scripts": "^2.1.3",
"#ionic/storage": "^2.0.1",
"ajv": "^5.2.2",
"autoprefixer": "^7.1.2",
"chat-plugin": "file:onymos-plugin-chat",
"cordova-ios": "^4.4.0",
"cordova-plugin-compat": "^1.1.0",
"cordova-plugin-console": "^1.0.5",
"cordova-plugin-contacts": "^2.3.1",
"cordova-plugin-device": "^1.1.4",
"cordova-plugin-facebook4": "^1.9.1",
"cordova-plugin-mixpanel": "^3.1.0",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.2",
"cordova-plugin-whitelist": "^1.3.1",
"cordova-plugin-x-socialsharing": "^5.1.8",
"cordova-sqlite-storage": "^2.0.4",
"es6-promise-plugin": "^4.1.0",
"ionic-angular": "^3.6.0",
"ionic-plugin-keyboard": "^2.2.1",
"ionic2-auto-complete": "^1.5.2-beta",
"ionicons": "3.0.0",
"ng2-validation": "^4.2.0",
"onymos-plugin-chat": "file:onymos-plugin-chat",
"phonegap-plugin-push": "^2.0.0",
"rxjs": "^5.4.0",
"sw-toolbox": "3.6.0",
"zone.js": "^0.8.12"
},
"devDependencies": {
"#angular/cli": "^1.2.7",
"#ionic/app-scripts": "1.3.7",
"#ionic/cli-plugin-cordova": "1.6.2",
"#ionic/cli-plugin-ionic-angular": "1.4.1",
"ionic": "3.7.0",
"typescript": "2.2.1"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-console": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {},
"cordova-sqlite-storage": {},
"cordova-plugin-x-socialsharing": {},
"cordova-plugin-contacts": {
"CONTACTS_USAGE_DESCRIPTION": " "
},
"cordova-plugin-facebook4": {
"APP_ID": <FB app ID>,
"APP_NAME": "MyApp"
},
"cordova-plugin-mixpanel": {},
"phonegap-plugin-push": {},
"onymos-plugin-chat": {}
},
"platforms": [
"ios"
]
}
}
UPDATE
After removing the iOS platform from my project (for another reason) and re-adding it, I no longer see the hanging behavior on the startup screen. I still see the error in the console output- however it doesn't appear that it was the cause of the hanging I was observing. My guess is that removing and re-adding the iOS platform reset something related to one of my plugins.

Posting my update as an answer for closure, in case anyone else hits this:
After removing the iOS platform from my project (for another reason) and re-adding it, I no longer see the hanging behavior on the startup screen. I still see the error in the console output- however it doesn't appear that it was the cause of the hanging I was observing. My guess is that removing and re-adding the iOS platform reset something related to one of my plugins.

Related

App keeps launching to a blank screen Test Flight React Native expo

App is working fine in Android Device after production
and its working fine on ios expo. but when i create .ipa file for production and test app via testflight its stuck on white screen.
so app store is keep showing me this reult.
I am Attaching my App.js code
import React, { useCallback, useEffect, useState } from 'react';
import { createStackNavigator } from '#react-navigation/stack';
import { NavigationContainer } from '#react-navigation/native';
import * as SplashScreen from 'expo-splash-screen';
import { Button, Text,BackHandler, View,TouchableOpacity,StyleSheet,Image,ActivityIndicator,StatusBar,AsyncStorage } from 'react-native';
import Navigations from './Navigations'
const Stack = createStackNavigator();
function App() {
useEffect(() => {
function prepare() {
SplashScreen.hideAsync();
// Pre-load fonts, make any API calls you need to do here
}
prepare();
}, []);
return (
<NavigationContainer>
<Navigations>
</Navigations>
</NavigationContainer>
);
}
export default App;
Now my package.json
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"#react-native-community/datetimepicker": "^3.5.2",
"#react-navigation/material-bottom-tabs": "^6.0.9",
"#react-navigation/native": "^6.0.6",
"#react-navigation/native-stack": "^6.2.5",
"#react-navigation/stack": "^6.0.11",
"#redmin_delishaj/react-native-select": "^1.0.6",
"#stripe/stripe-react-native": "0.2.2",
"#unimodules/core": "~7.2.0",
"#unimodules/react-native-adapter": "~6.5.0",
"expo": "^43.0.0",
"expo-apple-authentication": "^4.0.3",
"expo-av": "^10.1.2",
"expo-document-picker": "^10.0.3",
"expo-facebook": "^12.0.3",
"expo-google-app-auth": "~9.0.0",
"expo-image-picker": "^11.0.3",
"expo-permissions": "^13.0.3",
"expo-splash-screen": "~0.13.5",
"expo-status-bar": "^1.1.0",
"i": "^0.3.7",
"install": "^0.13.0",
"moment": "^2.29.1",
"nodemon": "^2.0.15",
"npm": "^8.1.1",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-credit-card-input": "^0.4.1",
"react-native-customizable-checkbox": "^1.0.14",
"react-native-dropdown-picker": "^5.2.3",
"react-native-image-overlay": "^0.1.2",
"react-native-image-pan-zoom": "^2.1.12",
"react-native-image-slider-box": "^1.1.9",
"react-native-image-viewing": "^0.2.1",
"react-native-keyboard-aware-scroll-view": "^0.9.4",
"react-native-material-menu": "^1.2.0",
"react-native-paper": "^4.9.2",
"react-native-pull-to-refresh": "^2.1.3",
"react-native-ratings": "^8.1.0",
"react-native-render-html": "^6.3.0",
"react-native-responsive-screen": "^1.4.2",
"react-native-swiper-flatlist": "^3.0.15",
"react-native-vector-icons": "^9.0.0",
"react-native-video-controls": "^2.8.1",
"react-native-web": "0.17.1",
"react-native-webview": "11.13.0"
},
"devDependencies": {
"#babel/core": "^7.12.9"
},
"private": true
}
and i am posting reply from App store
Guideline 2.1 - Performance - App Completeness
We continue to run into the same bug in your app. Specifically, your app keeps launching to a blank screen and no further content loads. Please review the details below and complete the next steps.
Review device details:
Device type: iPhone and iPad
OS version: iOS 15.1
Next Steps
Please run your app on a device to reproduce the issues, then revise and submit your app for review. If at first you're unable to reproduce the issue, try the following:
For new apps, uninstall all previous versions of your app from a device, then install and follow the steps to reproduce.
For app updates, install the new version as an update to the previous version, then follow the steps to reproduce.
If we misunderstood the intended behavior of your app, please reply to this message in Resolution Center to provide information on how these features were intended to work.
Actual Screen shot from ios Device
I am having this issue too but I believe one of my changes fixed and then introduced it. Check out your “main”: and “metro.config.js” if you have one, expo is picky in their structured workflows.
Might also be missing linked react native packages, react-native-svg makes me want to never use svgs in expo

"tried to register two views with the same name RNCSafeAreaProvider" error on IOS

I'm receiving the following error when running react native app using expo on IPhone (on android it's working correctly)
An image of the error is attached.
In addition, this is my package.json file:
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"#expo/vector-icons": "^12.0.4",
"#react-native-community/masked-view": "^0.1.10",
"axios": "^0.21.1",
"expo": "~40.0.0",
"expo-app-loading": "^1.0.1",
"expo-font": "^9.0.0",
"expo-status-bar": "~1.0.3",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz",
"react-native-gesture-handler": "^1.10.3",
"react-native-reanimated": "^2.0.1",
"react-native-safe-area-context": "3.1.9",
"react-native-screens": "^2.18.1",
"react-native-web": "~0.13.12",
"react-navigation": "^4.4.4",
"react-navigation-header-buttons": "^7.0.0",
"react-navigation-stack": "^2.10.4",
"react-redux": "^7.2.3",
"redux": "^4.0.5"
},
"devDependencies": {
"#babel/core": "^7.9.0" },
"private": true
}
Any idea will be appreciated.
you have two versions of react-native-safe-area-context installed in your app. remove react-native-safe-area-context from your dependencies and run expo install react-native-safe-area-context
In this link you can find the solution approved by a collaborator.
In my case, problem persisted and I did as suggested in the link above but I skip steps 2 and 5. I kept expo version in 4.1.0.
delete node_modules and your lockfile (package-lock.json /
yarn.lock)
change the expo package version in package.json to 38.0.8
remove react-native-safe-area-context from your package.json
run yarn or npm install
run expo install react-native-safe-area-context
try running
cd ios && pod install

when I run this NPX POD-INSTALL it gives me this COCOAPODS IS NOT SUPPORTED IN THIS PROJECT #ReactNative

Package.json
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"#react-native-community/masked-view": "^0.1.10",
"#react-native-firebase/app": "^8.4.2",
"#react-navigation/native": "^5.6.1",
"#react-navigation/stack": "^5.6.2",
"expo": "^39.0.3",
"expo-ads-admob": "~8.3.0",
"expo-av": "~8.6.0",
"expo-image-picker": "~9.1.0",
"expo-status-bar": "^1.0.0",
"expo-web-browser": "~8.5.0",
"firebase": "7.9.0",
"lottie-react-native": "~2.6.1",
"react": "~16.11.0",
"react-dom": "~16.11.0",
"react-native": "^0.63.3",
"react-native-appearance": "~0.3.3",
"react-native-dark-mode": "^0.2.2",
"react-native-elements": "^2.3.2",
"react-native-gesture-handler": "^1.6.1",
"react-native-hide-show-password-input": "^1.1.0",
"react-native-material-ripple": "^0.9.1",
"react-native-paper": "^4.0.1",
"react-native-reanimated": "^1.9.0",
"react-native-safe-area-context": "^3.0.2",
"react-native-screens": "^2.9.0",
"react-native-tts": "^3.2.0",
"react-native-vector-icons": "^7.1.0",
"react-native-web": "~0.11.7",
"react-navigation": "^4.4.0",
"react-navigation-stack": "^2.8.2",
"yarn": "^1.22.10"
},
"devDependencies": {
"#babel/core": "^7.8.6",
"#types/react": "~16.9.41",
"#types/react-native": "~0.62.13",
"typescript": "~3.9.5"
},
"private": true
}
This is Package.json of my project in react native. How to install cocoa pods in this project I read somewhere that when using expo dependencies in the project you can't install cocoapods in the project so how to install cocoa pods when using expo dependencies
You just can't install cocoa pods when using expo, that simple. If you need some library from react native community that needs to install cocoa pods, you just can't use it unless expo made its own. You can check if that library is available for expo here: https://docs.expo.io/versions/latest/
Almost everything from react native community has its own expo version if needed.
To install, use $ expo install <module-name>.
You should use expo bare workflow if you want to add react native librairies which are not included in expo client already.
With Expo bare workflow you can still use expo modules like expo-ad-mobs and even expo client if you have some fail over strategy for your newly added librairies.
https://docs.expo.io/bare/exploring-bare-workflow/
But you will have to build the app yourself, while expo managed workflow lets you use expo cli & infrastructure to build your ipa/apk.
If you just want to build the app and not add any other library, just use expo cli commands like expo build:ios

Ionic/Cordova Plugins not included in Xcode project

I have a Ionic v1 project and I have an issue when building on ios. Almost all of my cordova plugins are not added in the Xcode project in the left column under the folder plugin.
Cordova version : 6.2.0
Xcode version : 8.3.3
I have done :
cordova platforms rm ios
cordova platforms add ios
cordova build ios
It compiles fine but the plugin files are not added in my Xcode project (when I run the app, I have a lot of XXXPlugin class CDVXXXX (pluginName: XXX) does not exist).
The plugin files are added in the platforms/ios/MyProject/Plugins (I can see the different folders and the files .h et .m).
But when I open the Xcode project, there are only the files of one of my plugins (Branch.io), all the others are not here (cordova-plugin-camera, cordova-plugin-geolocation, cordova-plugin-inappbrowser, etc.)
In my config.xml, seems ok (example : <plugin name="cordova-plugin-geolocation" spec="~2.4.3" />)
In platforms/ios/MyProject/config.xml, seems ok as well (example : <feature name="Geolocation"><param name="ios-package" value="CDVLocation" /></feature>)
I could add them manually but it takes time and every time I remove and re-add platform, I would have to do it again.
I don't know what to do, any ideas of what I'm doing wrong ? Why is XCode stopping importing plugin files after the first one (BranchSDK which appears to be the first one in alphabetical order by the way) ?
My package.json :
{
"name": "myapp",
"version": "1.1.1",
"description": "myapp: An Ionic project",
"dependencies": {
"grunt-contrib-compress": "^1.3.0",
"grunt-contrib-uglify": "^2.0.0",
"gulp": "^3.5.6",
"gulp-concat": "^2.2.0",
"gulp-minify-css": "^0.3.0",
"gulp-rename": "^1.2.0",
"gulp-sass": "^2.0.4",
"ionic-native-transitions": "^1.0.2",
"moment": "^2.14.1",
"ng2-translate": "^2.2.2",
"plist": "^2.0.1"
},
"devDependencies": {
"angular-translate": "^2.15.2",
"bower": "^1.3.3",
"coffee-script": "^1.10.0",
"grunt-contrib-compress": "^1.3.0",
"grunt-contrib-uglify": "^2.0.0",
"gulp-angular-templatecache": "^2.0.0",
"gulp-ng-annotate": "^2.0.0",
"gulp-useref": "^3.1.2",
"gulp-util": "^2.2.14",
"mv": "^2.1.1",
"shelljs": "^0.3.0"
},
"cordovaPlugins": [
"cordova-plugin-whitelist",
"cordova-plugin-console",
"cordova-plugin-device",
"cordova-plugin-splashscreen",
"ionic-plugin-keyboard",
"cordova-plugin-network-information",
"cordova-plugin-geolocation",
"cordova-plugin-badge"
],
"cordovaPlatforms": [
"android",
{
"platform": "ios",
"version": "4.1.1",
"locator": "ios#4.1.1"
}
]
}
Thanks
Cordova version : 6.2.0
cordova#6.2.0 was released over 1½ years ago. Try updating to the latest version cordova#7.1.0
Then install the latest iOS platform: cordova platform add ios#latest
Xcode version : 8.3.3
While you're at it, update to Xcode 9 so you can build for iOS 11 / iPhone X.
delete plugins folder, node_module folder and platform/ios folder. Then run "npm install in the project root. The add ios platform

Run shell script failed when I use Xcode to build project with release deployment.

Issue Description
The log of error when build project looks like below.
node /Users/niyao/Company/Projects/EVE/EVERN/node_modules/react-native/local-cli/cli.js bundle --entry-file index.ios.js --platform ios --dev false --reset-cache --bundle-output /Users/niyao/Library/Developer/Xcode/DerivedData/EVE-bzggtbnrxixkvwgqyewmpxepvljo/Build/Products/Release-iphonesimulator/EVE.app/main.jsbundle --assets-dest /Users/niyao/Library/Developer/Xcode/DerivedData/EVE-bzggtbnrxixkvwgqyewmpxepvljo/Build/Products/Release-iphonesimulator/EVE.app
fs.js:584
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
Error: ENOENT: no such file or directory, open 'package.json'
Error Scenario
After I use package.json as below to npm instal new version, the error happens within release deployment scheme.
{
"name": "NYProject",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"lint": "./node_modules/eslint/bin/eslint.js index.ios.js index.android.js react/",
"watch": "npm-watch"
},
"watch": {
"lint": {
"patterns": [
"react",
"index.ios.js",
"index.android.js"
],
"extensions": "js",
"ignore": ".node_modules",
"quiet": false
}
},
"dependencies": {
"react": "15.3.1",
"react-native": "^0.32.0",
"react-redux": "^4.4.5",
"redux": "^3.5.2",
"redux-logger": "^2.6.1",
"redux-thunk": "^2.1.0"
},
"devDependencies": {
"babel-eslint": "^6.1.2",
"eslint": "^3.3.1",
"eslint-plugin-react": "^6.1.2",
"eslint-plugin-react-native": "^2.0.0",
"npm-watch": "^0.1.6"
}
}
The shell runs failed when build project within Release build configuration.
"./NYProject/node_modules/react-native/packager/react-native-xcode.sh"
Expected Results
Xcode could run shell when build the project. Before I upgrade the package.json configuration, it did run successfully.
Additional Information
React Native version:
react-native-cli: 0.2.0
react-native: 0.32.0
Platform(s) (iOS, Android, or both?):
Xcode 7.3.1 iOS
Operating System (macOS, Linux, or Windows?):
OS X 10.11
I had the same issue, and for me, simply upgrading to react-native 0.33.0 solved the problem.

Resources