Flutter. Applying a different configuration for Testflight and the App Store - ios

The task is to use different API URLs inside the Flutter application for the app installed through the Testflight and for the app installed through the App Store.
Libraries like: store_checker and detect_testflight
do not give 100% results, and I cannot be sure that they will not stop correctly detecting the installation source after the next update.
I also cannot rely on the kReleaseMode constant, since there is no way to create a build that compiled in debug mode and uploads it on a Testflight. This can only be done in release mode.
Using custom configuration files and setting up the .gitattributes file also seems like a perversion, and is not suitable because, besides the local repositories of many developers, bitbucket is used, in which I cannot add my merge driver. Also, there is no guarantee that other developers will use this driver.
Tell me a simple and concise way to implement this? Didn't Apple come up with the idea that developers would need to use different settings for builds in Testflight and in App Store?

Related

Can I start using Flutter even though my app is already on Playstore?

I already uploaded my android app (written in Java) on Playstore, and now I want to upload it on Appstore as well. In order to save time, I decided to use a cross-platform, but I realized that I should have began to develop with Flutter since the beginning.
Is possible to start developing my app on Flutter even though it is already on Playstore? Or do I have to use another cross-platform like Kotlin multiplatform?
yeah sure you can start with flutter, you need to clarify these things :
package name should be the same as on Play Store.
you have to choose your old key alias and passwords.
For cross-platform you have to build a new app for the app store
You have java code that does not directly compile in flutter but you can use your logic and architecture which you build earlier you have to build new app for app store
But make sure you have to use your older package name and key store so you can override your java app(Live on play store) into a flutter app.
You can rewrite your app in Flutter and upload it to the Play Store to replace the current one. It’s just a matter of making sure to sign the built applications with the same key as it proves to Play Store that you are in control of both, and you’re making the switch willingly. Also, your new app will have to have a version greater than the one already available in the Play Store, as downgrades are not allowed.

Firebase Analytics events on iOS - test and production

The iOS app I am working on uses Firebase Analytics to report events. It works as expected, but the app is not in production yet. Once it is it would be preferable to have the events logged by real users separate from these logged when debugging.
What is the best way to have Firebase Analytics events logged separately for test and production?
First you will probably want to create a separate Firebase project for staging/debug.
Then you will have to configure your app to be able to use different resources based on build type. For Android we solved this using build flavors, not sure what the iOS equivalent is.
From docs (https://firebase.google.com/docs/projects/multiprojects):
By default, FirebaseApp.configure() will load the GoogleService-Info.plist file bundled with the application. If your development and production environments are configured as separate targets in XCode, you can:
Download both GoogleService-Info.plist files
Store the two files in different directories
Add both to your XCode project
Associate the
different files with the different targets using the Target
Membership panel.
If the builds are part of a single target, the best option is to give both configuration files unique names (e.g. GoogleService-Info-Free.plist and GoogleService-Info-Paid.plist). Then choose at runtime which plist to load.

Which configuration mode does TestFlight use?

I am setting up the production, staging and development stacks/configurations modes for my iOS and API (backend).
I figure the "RELEASE" mode definitely be when the application is public on the app store. I would like to know which configuration mode is used when the iOS application is distributed on TestFlight ?
I understood that the scheme is what determines which configuration mode is used. While I upload the .ipa to TestFlight the Archive scheme is used.
Therefore, now I would like to know if there is a way to have a different configuration for what is on TestFlight and what is released.
What I am trying to solve
We use TestFight to distribute the application to our external testers and stake holders. Therefore would like that application to have a different configuration (e.g. SERVER_ENDPOINT_URL)
Thanks!
Well, I found out that I what I want to accomplish is not possible. Nor was the system built in a way to address my issue.
So what I am doing now is.
Archiving a build with "debug" configuration
Uploading to TestFlight and distributing the executable
After testing is complete
Recompile / re archive the build with "release" configuration
Upload to iTunesConnect and publish the application
Thanks!
Apps are distributed to TestFlight in release mode. If I understand your question right, which I'm not sure I do, at the basic level you want to use a different endpoint URL in your release version. You can differentiate between debug and release using the following
#if DEBUG
static let baseURLString = "https://mydebugurl.com"
#else
static let baseURLString = "https://myreleaseurl.com/"
#endif
However for that to work you need to add custom flags to your build settings, see this question for more info
I hope that answers your question
As far as I know, you won't be able to provide "a different set of variables" for builds pushed to testFlight and app release. That is what it is there for, to test the same byte code that will be published to the public.
With that said, what you could do: Create a "version" endpoint. So if you know that when you first push build 1.2, you will want stakeholders/external testers to see it first. Send a request to your prod server, passing along the build version that is being used, if version == 1.2, point all endpoint traffic to your special "development" endpoints(creating a hostName variable in your SessionManager device side, and setting that accordingly will make that really simple), else push the user on to use prod data.

Use Visual Studio Tools for Apache Cordova to create an xcarchive instead of ipa?

We're using Visual Studio Tools for Apache Cordova to build our app for iOS (and Windows).
We have a Mac running the remote agent. This works well, except we've only been able to have the setup produce signed .ipa files.
We're now looking into being able to create an unsigned "app" that we can deliver to our customer. They will then sign it with their enterprise certificate and distribute it within their orgainization (not the App Store).
The recommended way to deliver the app to the customer seems to be to create an xcarchive (I have looked at the option to deliver an ipa signed with our develoepr cert and then have the customer resign it with iReSign, but that seems flaky).
Is there a way to do that with this setup without any manual steps on the Mac?
Any pointers in the right direction would be much appreciated.
As far as i have analyzed, the easiest way to create an xcarchive is to use cocoon cloud service. Infact, it does gives the flexibility of generating both xcarchive and IPA.
Also you have full control of your build process as it provides various config controls and it is already used by some renowned companies.Suggest to have a look at cocoon platform once.
I know you have mentioned that you cannot rely on 3rd party service but it is the easiest approach as far as i my analysis. Also it may be useful for someone who is struck with a similar issue to give it a shot.

Is it possible anyhow to load resources to an iOS app after it is installed on device?

I want to reduce the size of the app to its minimum level. So what all resources i can load from remote after installation? I know I can download images from remote. But can I download libraries or pods from remote after installation? I know we need those files to generate ipa files. Is there any way to setup app with minimum required code, and "load" rest of the code from remote, and is it even possible?
On a different note, I think there should be a framework which checks for existing libraries (like AF Networking) on device, and if it is not there, then downloads it, and all the apps which need it use it. This will help reduce the size of apps considerably.
For assets (images, movies, sounds, etc...) absolutely.
For executable code (libraries, frameworks and pods) absolutely not.
That would directly contradict one of the rules that Apple has in place on apps on the App Store.
Any executable code has to be bundled and submitted to the App Store for approval.
Apple's iOS developer guidelines state:
3.3.2 — An Application may not itself install or launch other executable code by any means, including without limitation through the use of a plug-in architecture, calling other frameworks, other APIs or otherwise. No interpreted code may be downloaded or used in an Application except for code that is interpreted and run by Apple’s Documented APIs and built-in interpreter(s).

Resources