How to check if app is installed from TestFlight OR AppleStore

367 views
Skip to first unread message

Rob Willett

unread,
Feb 24, 2017, 4:15:03 AM2/24/17
to phon...@googlegroups.com
Hi,

We're trying to find a simple method to check if our app has been installed locally from Xcode OR from Testflight OR from the App Store.

The reason for this is we need to use a slightly different notification path through our app for different types of installs. We want to use a sandboxed notification server for Xcode installs and a production notification server for TestFlight and Xcode installs. 

We have all the infrastructure working, thats pretty simple but at the moment we have to manually set a flag for Xcode usage and then change this flag, rebuild, and repackage for TestFlight. If we forget a compilation option or anything we start again <sigh>. Android is so much easier :)

Anyway, we looked around various plugin repositorys and can only find


which almost but not quite does what we want. 

The plugin returns TRUE if installed from Xcode OR TestFlight 
The plugin returns FALSE if installed from the AppStore.

We want 

The plugin to return TRUE if installed from XCode 
The plugin to return FALSE if installed from TestFlight OR AppStore.

Looking at the code (gulp) we can see it looks for sandboxReceipt in a string. That seems to be it for the test. Based on this we assume that Xcode uses sandboxReceipt as well as TestFlight. 

Any easy suggestions of how to check for this?

Thanks

Rob

Rob Willett

unread,
Feb 24, 2017, 10:25:14 AM2/24/17
to phon...@googlegroups.com
We've looked at this in more detail and the plugin doesn't work at all. It always thinks its an Xcode download and NOT a Testflight download even when we downloaded it from TestFlight.

It also appears that Apple makes life difficult for anybody trying to do what we want to do.

Still looking for suggestions but not hopeful 😢

Rob

jcesarmobile

unread,
Mar 2, 2017, 6:46:57 PM3/2/17
to phonegap
I think this should work

#ifdef DEBUG
    return YES;
#else
return NO;
#endif

Rob Willett

unread,
Mar 2, 2017, 11:21:53 PM3/2/17
to phonegap
Errrr.....?
--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com
---
You received this message because you are subscribed to the Google Groups "phonegap" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phonegap+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

jcesarmobile

unread,
Mar 5, 2017, 5:33:45 PM3/5/17
to phonegap
You have to create a plugin with that code

Taking the plugin you linked

- (void)detect:(CDVInvokedUrlCommand*)command { BOOL isDebug = NO;
#ifdef DEBUG
    isDebug = YES;
#endif
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:isDebug]; [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; }

Rob Willett

unread,
Mar 6, 2017, 11:37:39 AM3/6/17
to phon...@googlegroups.com
Ah! I understand now. 

So what this means is that the DEBUG flags is automatically set by Xcode for local builds and DEBUG is NOT set for Archive builds. In old world C this would be 

$(CC) -DDEBUG helloworld.c

and 

$(CC) hellowworld.c

If the DEBUG flag is automatically set (or unset) then this is a really useful thing to know.

Thanks


For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com
---
You received this message because you are subscribed to the Google Groups "phonegap" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phonegap+unsubscribe@googlegroups.com.

Rob Willett

unread,
Mar 8, 2017, 6:59:18 AM3/8/17
to phon...@googlegroups.com
We've cloned https://github.com/Arcticus/Cordova-Plugin---Test-Flight-Detector and rewritten it.

When we say cloned, we copied everything and as we learnt more about the plugin system and what we needed to do, it turns out the only thing that's the same is the github title :) Every other non-generic plugin line has gone, all the variables have changed. Its basically a whole new plugin that works differently to the original.

However, the important thing is that the code example provided seems to work. If we run it from Xcode we get true and from Alpha testing on TestFlight we get false. We've not tried it in Beta and not in production but can't see any reason why the logic would suddenly change from false to true as we promote it through the Apple system.

We're going to update the docs and actually reissue the plugin in its own right as a proper plugin rather than a fork as its' so different. We all feel quite chuffed (British slang meaning pleased with oneself) as we've never written a Cordova plugin before, even if it is very simple.

Thanks for your help

Rob

Kerri Shotts

unread,
Mar 8, 2017, 12:10:32 PM3/8/17
to phonegap
Way to go! It's a pretty good feeling when your own plugin works! :-)

On Wednesday, March 8, 2017 at 5:59:18 AM UTC-6, Rob Willett wrote:
...

jcesarmobile

unread,
Mar 12, 2017, 6:05:33 PM3/12/17
to phonegap
Good to see that my approach worked.
Only for your information, from Xcode you can install in release mode and that should make the code not detect that it was installed from Xcode.
So maybe instead of calling it Xcode detector, call it debug detector or something like that.

BTW, you sent a PR against their plugin
https://github.com/Arcticus/Cordova-Plugin---Test-Flight-Detector/pulls

Rob Willett

unread,
Mar 13, 2017, 12:32:17 PM3/13/17
to phon...@googlegroups.com
We're not that familiar with Github, so suspect we cocked something up. Whilst the rest of the world seems to like Github, we simply can't get on with it at all.

We'll look at renaming it to something else.

I think we have just deleted the PR. I hope so.

Thanks

Rob

Jan

unread,
Apr 24, 2017, 6:00:02 AM4/24/17
to phonegap
Yes you did.

For anyonw finding this via Google, here is the new plugin Rob created:
https://github.com/rwillett/Cordova-Plugin---XCode-Detector

Thanks Rob!

-J


Am Montag, 13. März 2017 17:32:17 UTC+1 schrieb Rob Willett:
We're not that familiar with Github, so suspect we cocked something up. Whilst the rest of the world seems to like Github, we simply can't get on with it at all.

We'll look at renaming it to something else.

I think we have just deleted the PR. I hope so.

Thanks

Rob
On Sun, Mar 12, 2017 at 10:05 PM, jcesarmobile <jcesar...@gmail.com> wrote:
Good to see that my approach worked.
Only for your information, from Xcode you can install in release mode and that should make the code not detect that it was installed from Xcode.
So maybe instead of calling it Xcode detector, call it debug detector or something like that.

BTW, you sent a PR against their plugin
https://github.com/Arcticus/Cordova-Plugin---Test-Flight-Detector/pulls

--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en

For more info on PhoneGap or to download the code go to www.phonegap.com
---
You received this message because you are subscribed to the Google Groups "phonegap" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phonegap+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages