Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone - How can I detect a device is running an adhoc build of my app at runtime

I want to use different API's when running adhoc deployments of my app compared to appstore deployments. Can this be found out at runtime? I know I can use #if TARGET_IPHONE_SIMULATOR and #if DEBUG when running from xcode but I want adhoc deployments to be detected as well. Any ideas?

like image 968
Brett Avatar asked May 22 '12 10:05

Brett


People also ask

What is adhoc build iOS?

Ad hoc distribution lets you distribute internal builds to a maximum of 100 registered devices per device family per year. You can register a device in Apple's developer portal using the device's UDID.

How do I run an iOS app in launch mode?

Open the MyApp/ios/myapp. xcworkspace in XCode. Go to Products > Scheme > Edit Scheme and select Release mode. Build the app.


2 Answers

Check that "../iTunesMetadata.plist" exists in your NSDocumentDirectory.

This file is present in app store builds only - and it's in the root of your application so it's safe for app store submission.

like image 116
Maria Zverina Avatar answered Sep 19 '22 20:09

Maria Zverina


Add a Preprocessor Macro for your AdHoc configuration in Build Settings. #if ADHOC // do something

like image 22
0x8badf00d Avatar answered Sep 20 '22 20:09

0x8badf00d