iPhone: Using Pre-processor Directives for Device Testing

/ Published in: Objective C
Save to your folder(s)

Copy this code and paste it in your HTML
  1. #if TARGET_IPHONE_SIMULATOR // Device will hit external server over cell network NSString const *ROOT_URL = @"http://www.external-site.com"; #else // Simulator will hit local server over LAN NSString const *ROOT_URL = @"http://localhost:8667"; #endif

URL: http://www.pathf.com/blogs/2008/12/iphone-sim-device-preprocessor/

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.