Ionic/Cordova Plugins not included in Xcode project - ios

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

Related

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

RNAppAuth, iOS build failed, Unknown type name 'namespace', react-native-app-auth

I am trying to add react-native-app-auth to existing, but quite fresh project with Expo.
I'm following your setup guide, so doing following steps:
yarn add react-native-app-auth#2.2.0 --dev
Add pod 'AppAuth', '>= 0.91'
cd iso && pod install
react-native link (EDIT: from root path of the project)
And I get:
rnpm-install info Linking react-native-app-auth ios dependency
rnpm-install WARN ERRGROUP Group 'Libraries' does not exist in your Xcode project. We have created it automatically for you.
rnpm-install info Platform 'ios' module react-native-app-auth has been successfully linked
which looks fine.
Then when I build in XCode i get the following error:
After searching the web I found it may be connected with compilator I changed it use Objective-C++:
and now I get more errors:
I also tried:
Changing Target version to 9.0
Doing it again
Praying 🙏
Nothing helps :( Xcode Version 9.3 (9E145)
app.js
{
"expo": {
"sdkVersion": "26.0.0",
"ios": {
"bundleIdentifier": "com.xxx.xxx",
"publishBundlePath": "ios/mobile-xxx/Supporting/shell-app.bundle",
"publishManifestPath": "ios/mobile-xxx/Supporting/shell-app-manifest.json"
},
"android": {
"package": "com.xxx.xxx"
},
"name": "mobile-xxx",
"slug": "mobile-xxx",
"version": "0.1.0",
"isDetached": true,
"entryPoint": "./index.js",
"detach": {
"scheme": "exp997ce9c6b4fd43cfa14f4eede063ecf5",
"iosExpoViewUrl": "https://s3.amazonaws.com/exp-exponent-view-code/ios-v2.4.4-sdk26.0.0-3bd935c7-cdd3-4002-8e44-4df857a675f2.tar.gz",
"androidExpoViewUrl": "https://s3.amazonaws.com/exp-exponent-view-code/android-v2.4.0-sdk26.0.0-e63d9209-070c-4118-b06b-c60e82da0b66.tar.gz"
}
}
}
package.js
{
"name": "mobile-xxx",
"version": "0.1.0",
"private": true,
"devDependencies": {
"jest-expo": "26.0.0",
"react-native-app-auth": "2.2.0",
"react-test-renderer": "16.3.0-alpha.1"
},
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"test": "jest"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"expo": "^26.0.0",
"prop-types": "^15.6.1",
"react": "16.3.0-alpha.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-26.0.0.tar.gz",
"react-native-app-auth": "^2.2.0",
"react-native-router-flux": "^4.0.0-beta.28",
"react-redux": "^5.0.7",
"redux": "^3.7.2"
}
}
UPDATE: I have just setup a fresh Expo app following this guide and have exactly the same error. 😞
The problem is that there is an import in header search paths, which searches in the whole /ios folder:
$(SRCROOT)/../../../ios/**
If you happen to use Expo and CocoaPods, there will be boost-for-react-native as a dependency inside your Pods folder. In fact, any package depending on boost will cause this problem. XCode tries to build boost as well, but it has some non-ObjC files, so it will fail.
In order to fix the issue:
Open RNAppAuth.xcodeproj, switch to Build Settings tab and search for header search paths. Replace line $(SRCROOT)/../../../ios/** with
"$(SRCROOT)/../../../ios/YOUR_PROJECT_NAME",
"$(SRCROOT)/../../../ios/Pods/AppAuth/**",
Please note that these changes will disappear after using npm install (or yarn). To make these changes permanent, you can use patch-package.
Edit: this issue has been fixed, using the latest version of the package should work now.

React-native & Xcode: Project builds but cannot create archive

I'm using mobx & decorators.
The project runs fine in the simulator via "npm run ios" and it also builds in Xcode without errors.
When I try to create an archive it fails with:
"SyntaxError in /mobx-stores/UserStore.js: Method has decorators, put the decorator plugin before the classes one."
Here's my bable.rc:
{
"presets": [
"babel-preset-react-native-stage-0/decorator-support",
"react-native"],
"env": {
"development": {
"plugins": [
"transform-react-jsx-source",
"transform-decoratorslegacy"
]
}
}
}
Versions in package.json:
"react": "16.2.0",
"react-native": "0.52.0",
"mobx": "^4.0.1",
"babel-preset-react-native-stage-0": "^1.0.1",
"babel-preset-react-native-stage-0": "^1.0.1",
I've tried many work arounds without success.
Bottom line: Is it possible (or advisable) to use decorators in a react-native project used with Xcode?
Any info would be much appreciated!
Sigh,
I missed the fact that my bable.rc uses 'env' for plugins and I guess an archive build will not set the 'dev' environment variable.
Fixed up the bable.rc and it now creates an archive.

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

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.

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