Question

Assume this scenario, there are several apps which will use shared feature. THis feature want to know what's current application's app Id. My question is: Is there a way to get the application's app Id programmatically. Or What I need do is always find the app id in iTunes and hard coded into my app?

Edit: I do not make the question clear enough. the app id for twitter in app store is 333903271 and I can use this link(itunes.apple.com/us/app/twitter/id333903271?mt=8&uo=4) to open twitter in appstore. I want this app id, not the bundle id. thanks.

Was it helpful?

Solution

That is a feature of the app store, not the OS. For example, until you setup your app in the app store, you won't have this ID. Instead, once you know the id, you should store it in your App's Info.plist then you can just query it via NSBundle objectForInfoDictionaryKey:.

As long as all your apps store it using the same key, your shared component can rely on it being there.

OTHER TIPS

[[NSBundle mainBundle] bundleIdentifier] should get you what you're looking for.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top