Is there a way to pass command line options to my iOS app from Xcode?

Charles Randall picture Charles Randall · Jun 8, 2011 · Viewed 9.7k times · Source

I'm hoping to find a method to pass certain information in to my app when I launch it during testing, so that I can perform special debug tasks. Xcode has a section "Arguments Passed on Launch", and I assumed they would show up in my UIApplicationDelegate's application:didFinishLaunchingWithOptions: but the dictionary that's passed in is always nil.

Am I going about this the wrong way?

Answer

Deepak Danduprolu picture Deepak Danduprolu · Jun 8, 2011

You can access them using NSProcessInfo object like this,

NSArray * arguments = [[NSProcessInfo processInfo] arguments];