I'm building an iOS application using Xcode/Swift, and I have a few less-than-technical group members who don't really know how to build Xcode projects, but are interested in seeing/testing the progress of the application. One group member pointed out that they could test the app using Ionic/Ionic View. However, to my understanding, Ionic works by building an application in the specific Ionic framework, and then Ionic translates the project into an Xcode/Swift project (.xcodeproj) or an Android project. Is there a way to do the reverse conversion––is there a way to convert my Xcode project so that it will work on Ionic, or specifically Ionic View?
Ionic is tool like cordova created to develop hybrid apps (from HTML+JS+CSS --> to Native iOS/Android/WinPhone/BlackBerry). The UI is running in native webView, and using some native functionalities by plugins but it is not created to make Ionic/Cordova app from native.
If you want to share your app to tests, use Apple TestFlight
'Ionic View' is a very good advice and the one I would suggest in your case as well.
You don't have to do anything in your code really to use it, just create an ionic account and in your terminal, change into your ionic project directory and then type:
$> ionic upload
You will be asked for the usernmame and password of the account you just created, the application will be uploaded and you will get a unique app ID. You can then share that ID with anyone who you want to test your app, as long as they have the Ionic View app installed on the their iOS or Android devices.
Also do make sure you have updated your global ionic and cordova packages to the latest version before you upload:
$> sudo npm uninstall -g ionic && sudo npm install ionic
Now, as 3squad mentioned, many of they Ionic Native plugins are not supported so don't expect everything to work, but it's a good start to show most of your app and design running.
Here's a list of currently supported plugins.
Please do keep in mind that the performance using Ionic View will be far worse than if you actually build, release and give your users and actual production .apk or .ipa file to install. This latter approach would also showcase the full, final performance and functionality resulting from your code, but it may be more cumbersome.
Here's how to release a production version of your app.
Related
I want to be able to test an app created with react-native init through the expo app downloaded from the app store. How can I do this?
I'm trying to use pure react native (no expo at all) and want to test my code on my iOS device. A while ago, I was able to do this through the expo app simply by running npm start. However, now when I run npm start I only see Running Metro Bundler on port 8081..
You cannot run a project created with react-native init with the Expo app. However, you can use https://snack.expo.io/ to test plain React Native code in either the browser emulator or on your device (which will open through the Expo app) by pointing your iOS camera app at the QR code they display for you. The caveat to this is that you cannot use native modules within a Snack.
Depending on the size of your app, you can port your code over from react-native init into a freshly created expo project. I have managed to do this on several projects in the past with great success. The process can be tedious depending on the age of your dependencies however.
I noticed that Cordova is not compatible with the latest version of Xcode 10. To test the app I use this command:
cordova run ios --buildFlag='-UseModernBuildSystem=0'
and it works all correctly. I would like to know if it is possible to load applications built with the old Xcode system on the app store.
Using XCode legacy build system works completely fine when uploading to the AppStore. I still maintain an ionic 1 project that way.
Also, might I suggest checking out the release notes on the new build system which might answer some of your questions: https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes/build_system_release_notes_for_xcode_10
I'd like to integrate react-native modules in already existing iOS App but keeping both solutions separately.
Instead of doing this https://facebook.github.io/react-native/docs/integration-with-existing-apps.html which modifies the existing solution, I would like to have a standalone react-native solution and somehow import the Xcode project of the react-native app into my already existing app.
This allows me to continue developing the already existing app without being affected by the RN solution which installs and add libraries to the Xcode project.
Basically the concepto would be to export the react-native solution as a bundle or static library and import it in my already existing iOS App. After that interact with this library from the already existing iOS App and also allow the React-Native Solution library interact with the already existing app. There should be a way to communicate from the already existing app to the RN Solution library and also from the RN solution library with the already existing (i.e. for launching modules from the already existing iOS app and also from the RN solution be able to launch views of the already existing app)
Is this possible?
You can do most of the things you are referring. Excuse me if a miss something...
Runninig as standalone
If you don't have ios and android folders in your RN directory, you must run react-native eject from CLI.
React-native application can be started as a standalone native app using the CLI commands below:
react-native run-ios (only on MacOS)
react-native run-android
Add --port #### if the default is being used.
Both commands will start something like a sandbox native app which will load the JS inside. It will also start the Metro bundler which will serve the js bundle as well.
Loading RN into existing app
You need to add the native RN libraries for Android and iOS as dependencies, so you can use them to load either the JS bundle from the Dev server or insert the JS bundle within the native build.
To use the dev server run react-native start.
To build the JS as a file which will be added to the native package you must run:
react-native bundle ios
Followed by couple of options
--dev false or true
--entry-file index.ios.js change this to match your entry file. It may be just index.js. Be carefull to match the name inside Java/Obj-C code.
--bundle-output ../YOUR-EXISTING-IOS-APP/main.jsbundle
--assets-dest ../YOUR-EXISTING-IOS-APP
Communication
This happens over the RCTBridge.
Check this page for a explanation and examples how to access native functionality from the RN environment.
I have inherited a Cordova project that mixes web code with native code.
I'm using cordova CLI 6.3.1 and the cordova ios platform version is 3.9.2.
Whilst working I come across this warning in the console.
Using this version of Cordova with older version of cordova-ios is
being deprecated. Consider upgrading to cordova-ios#4.0.0 or newer.
However, when I try updating the ios platform version using cordova platform update ios --save it completely wipes out all files in the "platforms" folder - which currently includes all the custom iOS project files, i.e. custom classes and what not.
Is there something fundamentally wrong with our project setup?
What is the recommended way to mix and match cordova web and native iOS code so that updating the cordova ios platform doesn't nuke everything?
Generally, the files under /platforms are generated on the fly based on changes that are made in /www. Running cordova prepare ios, cordova build ios, cordova platform update ios, or cordova run ios, will always nuke the platforms/ios folder and retreat it based on /www.
You mentioned your project has custom native code. Is that native code built as a cordova plugin? If so then you should be good following the standard workflow. Work in /www. Test your project cordova run ios.
If not, you might want to consider refactoring the native code you have as a plugin.
Look at this plugin's code structure as an example.
Follow this guide on how to start developing a plugin.
I am trying to create a simple project with last phonegap version:
$ phonegap create my-project
$ phonegap build ios
$ phonegap install ios
All works perfectly and I see emulator with my simple application.
But I can't find documentation on how to run my application on device(iphone, for example) and not on a simulator.
All documentation by cordova / phonegap based on examples with cordova's template for xcode.
But last cordova's version don't have template for xcode and all that I need - cli, if I understand correctly?
I already registered as IOS developer and I have a valid iPhone development certificate.
When I connect my device - I can see it in xcode and I can run native application on my device.
But only via xcode.
I will be grateful to any advice.
If the cordova app builds and runs on the simulator, try running cordova run ios --device
This worked for me, when before it was only hitting the simulator.
Alternatively, if that STILL doesn't work for you, when you run codova build ios, to just build the app, you could use itunes to sync the generated .app file in <project_folder>/platforms/ios/build/device/AppName.app
There is an Apple CLI tool canned xcodebuild, as well as this wrapper around it by Facebook. I'd suggest trying out either that or look at the build-in xcodebuild shipped with xcode.
Hopefully one of them will work.
https://github.com/facebook/xctool
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html
If you use Cordova CLI, you should be able to do this:
cordova run ios