0

I have this project that we are trying to determine different environments to point to based off your current Provisional Profile. I noticed that there are some variables in the plist file that are in your project settings and you can read them from your plist such as: $(PRODUCT_BUNDLE_IDENTIFIER) $(EXECUTABLE_NAME)

Can I do the same thing with Provisional Profile? I added $(PROVISIONAL_PROFILE) and it did not work. I don't want to read the actual profile. Just need to know the name of the one currently selected.

user516883
  • 8,868
  • 23
  • 72
  • 114
  • How did you add the Provisional profile into Plist? – user3182143 Aug 05 '16 at 15:34
  • in which way did you add that? – user3182143 Aug 05 '16 at 15:34
  • This was a complete guess on my end the way I added it since I saw the other project settings options in there. I just added a new line call Provisional Profile with the value of $(PROVISIONAL_PROFILE). I just followed the format of the other options. Obviously this didn't work, but I am just curious on how to pull the name such as (Development, Dist) over to the plist – user516883 Aug 05 '16 at 15:53
  • Do you know the reason why it cant be done or a way to be able to fulfil understanding what provision profile is being used? maybe during the build process or something? – user516883 Aug 05 '16 at 17:13
  • First of all it is called a `Provisioning Profile`, not `Provisional Profile`. Secondly, have you looked at this : http://stackoverflow.com/questions/17584426/check-if-app-is-ad-hocdevapp-store-build-at-run-time ? – Losiowaty Aug 05 '16 at 21:51
  • Thanks @Losiowaty I am going to take a look at the link you sent. – user516883 Aug 08 '16 at 23:21

1 Answers1

0

I wouldn't key off of the provisioning profile for changing environments. Provisioning profiles change often (need to generate new development ones whenever a new device is registered, they expire every 12 months, etc.)

I would set up different build configs in your project that correspond to the different regions. Then you could change the region settings at compile time using preprocessor directives.

Step by step:

  1. Project menu -> Edit Project Settings -> Build tab
  2. Select All Configurations
  3. Scroll down to GCC 4.0 - Preprocessing
  4. Add the following to Preprocessor Macros Not Used in Precompiled Headers:

    CONFIGURATION_$(CONFIGURATION)
    

Assuming you have Debug, Adhoc and Release configurations, this will generate preprocessor macros for each configuration.

CONFIGURATION_Debug
CONFIGURATION_Adhoc
CONFIGURATION_Release

Then, in your code you can key off of these configurations to configure your regions.

#if defined (CONFIGURATION_Debug) || defined (CONFIGURATION_Adhoc)
    NSLog( @"Warning message");
#endif

You can get more details into this technique here.

If you still want to inspect the provisioning profile (after build, it would be copied to the the embedded.mobileprovision), you could use something like this. The only scenario I could see this providing a benefit is if you resign the binary after you build it and would like the re-signed binaries to change regions.

wottle
  • 13,095
  • 4
  • 27
  • 68