How do I upgrade Android native app to new version based on NativeScript while keeping data from old app? - nativescript

I want to update an existing Android app (not made with NativeScript), with a new one (made with NativeScript).
The old app stored some user data in a SQLite database. I want this to survive the upgrade.
Now, I have the same app-id in the new app, as the old, so that part is in place. To test if the database survives though, I have started the Android Emulator with the old app, created a few records, then published the native script version using
tns run android --bundle --device=1
and this correctly replaces the old app with the new code, but at the same time it seems to wipe the database, which is otherwise correctly stored in /data/data/app-id/databases
Is this due to the tns deployment for debugging possibly starting out wiping the system, or something else ?
How do you guys test this?
Edit: Apparently the uninstalling after each compile, rather than upgrading is a known thing, tracked in their Github as issue #3382

tns run android --bundle produces a development version of APK which would not match the signature of your production version of APK built with native Android.
If you use the same signing certificate you used for the production native app while running app / building your {N} version of APK, then you will survive the upgrade by default.
So your command may look like
tns [build|run] android --bundle --release --keyStorePath /path/to/keystore --keyStorePassword keystore-password --keyStoreAlias keystore-alias --keyStoreAliasPassword keystore-alias-passwrd
Read more on docs.
Edit: CLI seems to have a known issue with tns run, instead of replacing the APK, it deletes the old version and installs new version. So it should not be a problem when you publish the APK built with tns build. Credits to #DimitarTachev.

Related

Can't submit mac build to testflight - xcode v14.2

I am trying to submit my build for a mac os app to testflight but i get the error -
This build is using a beta version of Xcode and can’t be submitted.
Make sure you’re using the latest version of Xcode or the latest seed
release found on the releases tab in News and Updates
I am using Xcode Version 14.2 (14C18), I am not sure if its beta, but it is the latest one available in the app store.
Do I need to downgrade to some previous version or there is some other issue? Thanks.
After hours of debugging I found the issue. My Info.plist file was missing several metadata info like -
<key>DTXcode</key>
<string>1331</string>
<key>DTXcodeBuild</key>
<string>13E500a</string>
After adding those testflight accepted the build.

Build failed with CrashlyticsOrgIdException

I just integrated the new Firebase SDK following these instructions:
https://firebase.google.com/docs/crashlytics/get-started-new-sdk
It's working with debug builds, but I get this exception on release build:
java.io.IOException: com.google.firebase.crashlytics.buildtools.exception.CrashlyticsOrgIdException: Could not fetch Crashlytics Org Id
Any idea?
I was having the same error when trying to build a release APK, but it wasn't going away.
I realized that you need to generate at least one crash in Firebase Crashlytics before your Org Id becomes available.
After my first crash was visible in the Firebase Crashlytics Report page, release build started working.
So, make sure to follow the Firebase doc and run a test crash in debug before you try to build release.
There seems to be a bug with the new firebase crashlytcs SDK where the Org Id is not generated unless the app is run with the firebase crashlytcs set up.
I followed the older sdk documentation which uses Fabric and ran the app with that. This is the older doc : https://firebase.google.com/docs/crashlytics/get-started?platform=android
Update to the new crashlytics SDK then and the project should build for you now. This is the new doc : https://firebase.google.com/docs/crashlytics/get-started-new-sdk?platform=android
You need to go through all steps in Firebase web console in Crashlytics section until you'll see:
Build and run your app
We'll be listening for your app to communicate with our servers.
Then you can build an apk.

Is there a recommended way to distribute iOS apps to testers prior to publishing on the app store?

I need to distribute my apps to testers prior to submitting them to the store(s). Nativescript builds an apk file that is easily distributed to Android testers. Is TestFlight the recommended way to distribute iOS apps? And should I use the xcode project file to build the app in Xcode in order to submit it to TestFlight. That method seems counter intuitive.
Yes, ideally you would use TestFlight. It's also a perfect way for you to test your distribution build/signing etc since you would upload the exact same build that will end up on the App Store. In fact, if your testing goes well with your users, you can submit the same build that you've already uploaded for TestFlight to the reviewers for the App Store, you don't even need to upload a new build.
As #Dave Wood mentioned, yes, TestFlight should be the way to go forward as you do not need to re-build the app to submit for review to Apple.
Answer to your next question should I use the xcode project file to build the app in Xcode -
No
You can use the below commands to build and publish app to Apple store.
From the root folder of your app
tns build ios --release --for-device --bundle <Your Provision Profile>
this will show the path where it has created the .ipa file, then
tns publish ios --ipa <.ipa file>
this will ask your Apple ID and App Specific password and will process the actual App based on your appid mentioned in your package.json.
You can change the app version and App name in info.plist inside App Resources->ios folder.
Thanks. I realized this was the answer after I posted the question. I'm new to NativeScript, but not to iOS development. It occurred to me that once the app is uploaded to App Store Connect, I still control the activities of either posting or setting up TestFlight. Thank you.

Google iOS SDK fails to archive (use of undeclared identifier errors)

I have attempted to archive my project for submission to App Store, however, every time I get errors "use of undeclared identifier" for everything related to google iOS SDK. The application itself runs and builds flawlessly with the discussed SDK integrated, the only thing that fails is the archive process. I have tried both cocoa pods and manual method of integration (separately, of course). Furthermore, I used the latest xCode versions (6.4 and 7 beta 4) on two different macs running OS X 10.10.4. This is the guide I have been using.
Your issue has something to do with the configuration of archiving in combination with your Release settings. If you change the scheme settings Command + < to use the Debug configuration for archiving, you may be able to successfully archive your app. This means that somewhere you are probably not matching the Debug and Release configurations.
See the following screenshot for example project Build Settings that are missing the Swift bridging header in release:
Add bridge.h to the release configuration and you will be able to build with the Release schema and you will be able to archive under release configuration.

Is it possible to run jenkins with two different iOS sdks

We are using Jenkins to run our xcodebuilds on a Mac Mini server. In the last weeks we started development of iOS 7 apps and we installed Xcode 5 DP versions on the Mac Mini.
When installing a new Xcode version and configuring the xcodebuild of the new Xcode which xcode-select this new version is also used for building our old iOS 6 apps - which breaks the UI of them.
Is there a way to tell Jenkins which xcodebuild it should use to build a project?
Check out the solution posted by Andy Molloy at http://andymolloy.net/specifying-xcode-version-for-jenkins-projects.
You have to install EnvInject plugin for Jenkins and add DEVELOPER_DIR=/Applications/Xcode5-DP6.app/Contents/Developer environment variable to your build job.
It doesn't look like it is possible to specify xcode version per jenkins job. Also switching xcode version on the command line requires root permissions.
You might manage to solve your issue by making sure your IOS 6 apps, when built with the new xcode, work properly. Try selecting the proper base SDK and deployment target http://www.clarkcox.com/blog/2009/06/23/sdks-and-deployment-targets/
If that won't work you could try forcing a switch of the xcode version to use at build time, pre xcode plugin use. You will have to fiddle with sudo rights. Given that this is a system setting, you might need to prevent multiple builds from happening simultaneously.
I would do my best getting the multiple builds working with a single xcode version though.
Select the xcode version at runtime
Use EnvInject plugin
for jobs that require the non default do something like
DEVELOPER_DIR=/Applications/Xcode6.0.1.app/Contents/Developer
under Inject environment variables to the build process
https://wiki.jenkins-ci.org/display/JENKINS/Xcode+Plugin

Resources