Query app id of current app on iOS [duplicate] - ios

This question already has answers here:
Is it possible to get app id from iOS application programmatically?
(7 answers)
Closed 8 years ago.
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.

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.

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

Related

Is there any way to generate an unique ID for device without using IDFA? [duplicate]

This question already has an answer here:
How do I check where my app is using IDFA
(1 answer)
Closed 4 years ago.
I have to generate an unique ID for each device. Right now, I take device's unique ID with this way:
let uniqueStr = UIDevice.current.identifierForVendor?.uuidString
But in App Store Submission, this error come up:
Your app is using the Advertising Identifier (IDFA). You must either
provide details about the IDFA usage or remove it from the app and
submit your binary again.
My app has nothing to do with advertisement at all. Is there any way to get unique ID without getting this IDFA error?
It seems that apple throws this error when Advertising Identifier (IDFA) is being used not identifierForVendor.
It might be possible that some 3rd party library is using it. You can check for the actual reason for what or which framework using the IDFA from below stackoverflow answer:
How do I check where my app is using IDFA
Then,
Either update your library accordingly or
You can select using IDFA option while submitting the app.

How to fetch all music apps name contains in device [duplicate]

This question already has answers here:
Finding list of installed apps on iphone
(7 answers)
Closed 6 years ago.
I have to fetch all music apps name contains in device (like google play,gaana,saavan) and has to show all name in my app. I search a lot but not able to find a solution.Please help me if anyone has an idea.
Is there any way to fetch downloaded music files or list from iTunes store?
iOS applications are installed in Sandboxed environment, meaning that they cannot do anything outside their own application. It may work on Jailbroken devices!
More details given in this link,

How to identify iOS device uniquely instead of using UUID and UDID [duplicate]

This question already has answers here:
Unique Identification of iOS device for iOS 7.0 and above
(6 answers)
Closed 6 years ago.
In my iOS app, I have to restrict the user to use iOS app per device. To do this I found a solution that we can use the UUID (Universally Unique Identifier) or UDID (Unique Device Identifier). But according to this answer I can't use UUID, because if app gets deleted or reinstalled UUID has been getting changed and I don't want this. Also Apple rejects apps if app uses UDID.
Is there any way to identify iOS device uniquely.
Apple has done away with the approach of UDIDs and will reject apps that use the same for unique device identification.
Source: TNW
What you are looking for is Vendor ID
I'm using this library for my projects, and it's working like a charm, please try :
https://github.com/blackpixel/BPXLUUIDHandler
easy to use :
Import BPXLUUIDHandler.h
Retrieve the UUID with
[BPXLUUIDHandler UUID]
Thats all...
Here is some info from project's github page :
As of iOS 5, Apple has deprecated the device unique identifier api and
hasn’t provided a friendly Obj-C replacement, instead recommending
CFUUIDCreate and NSUserDefaults.
CFUUIDCreate isn’t very complicated and neither is NSUserDefaults, but
this solution fails in a few different ways:
It’s not a quick one-shot call to get the UUID; you have to write your own wrapper to make it friendly
It doesn’t persist; deleting the app blows away the UUID (can be persisted if stored in the keychain though)
There’s no way to share it between apps

Adding Rate button in app confusion [duplicate]

This question already has an answer here:
Obtain Apple software id number before appstore submission (for Appirater)
(1 answer)
Closed 7 years ago.
My app isn't in the app store yet, in fact I haven't even uploaded it to iTunes Connect yet. I want to add a rate button in my iOS game. Rate button usually takes the user from the app to the link in the app store for your game. How do I add a rate button if my app is not in the app store yet since I don't have a link to the app store where my game would be.
Is there another way to add a rate button without my game being in the app store. Can the Rate button only be added when the App is in the app store (after release) or are there other ways before the app is in app store?
I know I'm going to have to use...
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#""]];
But what goes inside that string since my app is not in app store but I do have iTunes connect setup however for development at this time.
Create your app in Itunes Connect and you will be given an App ID. You can use this App ID to reference your app on the itunes app store:
http://itunes.apple.com/app/idyourID
Be sure to include id in front of your id number. I.e, id123456789
Another way would be to have your link in the cloud DB somewhere (i.e. Parse) and when the app is released update the link, but that would be overkill for this situation.

Serving ads only for users who didn't buy application [duplicate]

This question already has answers here:
Change paid app to free but know if user previously purchased it
(7 answers)
Closed 8 years ago.
I'm switching my iOS app from priced to free and adding ads instead. The issue is, some people already brought the app, and it would seem like a rip off if they start getting ads with the update. Is there a way I can check whether someone has already brought the app, and make it so that ads aren't delivered to them?
As far as I know there is no way to do this. You can't recognize point in time when user bought the app.
You can release (still paid) version that would record the fact the user has bought it somehow - either by marking it in defaults or sending device ID to your server. But this doesn't cover 100% cases. When old user completely deleted and install app again - or install the app on the new device - you will still serve them ads.
When you submit your new app, add a test with the version of your App.
Remove the ads for users who have a version less than the new one.
You can use this code to find the build version :
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:#"CFBundleShortVersionString"];

Resources