Is there a way to check it?
I have an application URL, which I don't want to be opened expect if the user have a uk appstore. unfortunately, this application is available in many country, so when I put 'gb' on the link, it be redirected to the local region of the user.
For iOS 13+, check the SKStoreFront class. It has a countryCode that returns the country code belonging to the user's current App Store region.
Swift
if let storefront = SKPaymentQueue.default().storefront {
print(storefront.countryCode) // Returns an Alpha-3 country code (USA, GBR etc.)
}
Obj C
[SKPaymentQueue defaultQueue].storefront.countryCode; // Returns an Alpha-3 country code (USA, GBR etc.)
You should be able to access the SKStoreFront instance by adding the StoreKit framework to your project, even if your app does not offer any purchases.
For more information, check out: https://developer.apple.com/documentation/storekit/skstorefront
You could use the in-app purchase Store Kit to achieve this.
Request the product list using SKProductsRequest then check the returned SKProduct's priceLocale to see if the user's AppStore is the UK one.
Related
My app store app link is https://itunes.apple.com/us/app/appname/appid?l=pl&ls=1&mt=8
How can i change the country code "us" so it will be listed on app store below a country code that i will choose?
If you want to link to a specific country, you have to change the "us" country code to one from Apple's country codes list: https://help.apple.com/app-store-connect/#/dev997f9cf7c
Examples:
https://itunes.apple.com/us/app/id0123456789 --> US
https://itunes.apple.com/fr/app/id0123456789 --> France
https://itunes.apple.com/de/app/id0123456789 --> Germany
Edit after end of the App Store affiliate program:
Recommended (=best user experience):
If you want to get a link that automatically "translates" into the user's language use the "geo" subdomain:
https://geo.itunes.apple.com/app/id0123456789 (You can actually leave the country code in the link, still gets changed to the right store)
this is code, i am using
SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewControlleralloc] init];
// Configure View Controller
[storeProductViewController setDelegate:self];
NSDictionary *parameters;
parameters = #{SKStoreProductParameterITunesItemIdentifier:kPlaylistID, SKStoreProductParameterAffiliateToken:kAffiliateID,
SKStoreProductParameterCampaignToken:kCampaignID};
The keys you reference are part of StoreKit. The affiliate and campaign tokens you reference are SKStoreProductParameter that became available with iOS 8.
In order to get those two tokens, you need to join the iTunes App Store Affiliate Program.
SKStoreProductParameterAffiliateToken: This is auto generated for you by the program. It will appear top right of screen once you're logged in.
SKStoreProductParameterCampaignToken: This is optional and user defined. You can add this in the iTunes Link Maker tool. There is a popup you can display by clicking Add Campaign Token, after you've selected a product to link to.
Both of these tokens should be represented as NSString.
Note that the current iTunes App Store Affiliate Program is different than the LinkShare program of a few years ago.
I am developing a location based Q&A SDK for mobile devices.
When a question is asked about a specific location, the server side targets the most relevant user and sends the question to that user. If the user fails to answer, the question is sent to the second best user, and so on.
The problem is that my SDK might be installed on more than one application on the device, meaning that the user can get a question more than once.
Is there a way to detect whether my SDK is installed on more than one app? I thought that sending the UDID to the server might work, but iOS UDIDs differ between applications.
You can use UIPasteboard to share data between applications on the device.
The UIPasteboard class enables an app to share data within the app and with another app. To share data with any other app, you can use system-wide pasteboards; to share data with another app that has the same team ID as your app, you can use app-specific pasteboards.
In your SDK, do something like this:
#interface SDKDetector : NSObject
#end
#implementation SDKDetector
+ (void)load
{
int numberOfApps = (int)[self numberOfAppsInDeviceUsingSDK];
NSLog(#"Number of apps using sdk:%d", numberOfApps);
}
+ (NSInteger)numberOfAppsInDeviceUsingSDK
{
static NSString *pasteboardType = #"mySDKPasteboardUniqueKey";
NSData *value = [[UIPasteboard generalPasteboard] valueForPasteboardType:pasteboardType];
NSMutableArray *storedData = [[NSKeyedUnarchiver unarchiveObjectWithData:value] mutableCopy];
if (!storedData) {
storedData = [NSMutableArray new];
}
NSString *bundleId = [[NSBundle mainBundle] bundleIdentifier];
if (![storedData containsObject:bundleId]) {
[storedData addObject:[[NSBundle mainBundle] bundleIdentifier]];
}
value = [NSKeyedArchiver archivedDataWithRootObject:storedData];
[[UIPasteboard generalPasteboard] setData:value forPasteboardType:pasteboardType];
return [storedData count];
}
#end
If you only want to provide an SDK, it is not possible. Apple has added security steps to prevent that for user privacy. Keychain sharing will not work, because apps must share the same bundle seed ID (see here for more info).
If you want to provide an app along with your SDK, then you could do something like Facebook does, where app sends a "helo" message, Facebook asks user and finally Facebook sends "ehlo" message.
Your App -> "I would like to use the SDK; please give me token" -> SDK Controller App -> (Remember which apps have requested use) -> "OK, you can use the SDK; here is a token: #123" -> Your App
The SDK controller app can now send the server the list of apps.
I think you can group the apps on the same device by IP address as they will use the same address to connect to your server.
So the IP address will represent the device and the API key will represent the app that uses the SDK.
Can you try using
advertisingIdentifier
Not sure whether it serves your purpose. It is explained in here ASIdentifierManager class reference : Apple doc
I think its possible using keychain, you can have an unique keychain key in which you can save anything you want, and can be accessed by other apps if available. So for your SDK, lets say if there is one app, it will register some value in keychain with a unique key which is private to your SDK only if the key doesn't exist, and if it exist you get to know, since you can save any value in keychain, you can try multiple options and combinations which suits you.
You can use KeychainItemWrapper for the implementations.
Elaboration
Lets say we have an method.
[MySDK register];
Which can be used anywhere, say in AppDelegate. The register method will generate a token for the app, for the device, which we will save in the keychain using an unique key we have defined in the SDK, say in com.mysdk.key. And while saving in keychain the SDK can actually do a registration.
We consider the above method is implemented in multiple apps.
Now we have scenario.
User installs an App-A which uses the SDK, the register method will call and create a token and will save in keychain for the first time.
Now user installs another App-B which also uses the SDK, the same register method will call, but now it will check for the key com.mysdk.key in keychain, if exist it will just update the count for the token, which meant for the device.
Note
Keychain not meant to save only unique identifier, you can save other informations too.
Update
Check demo projects https://db.tt/7xpKrgMp
The wrapper I have used in the projects is same as SDK in your case which is same in both the projects.
Cheers.
Is it somehow possible to get a list of all available products from the Play Store?
What I want to do is to get all available items and then show them in a ListView. Whenever someone taps the ListView the right item is opened in Google Play Store.
Is that possible? And if yes, how?
As mentioned in this post, this is now possible using the Google Play Developer API (a.k.a. android-publisher):
https://developers.google.com/android-publisher/
In particular, the Inappproducts: list API:
List all the in-app products for an Android app, both subscriptions and managed in-app products.
Third-paty apis and services are not reliable. There is no reliable and convenient way for production yet. You have to store it on your server in encrypted json data file for example, without any php/java/something, just static file.
OR you can guess item skus in your code and check even non-existing items: myitem_00-myitem_99 for example.
You can try this Google Play Store Api, or you can also look into this Android Market API.
But both of these are unofficial.
This url will show you what to do:
http://developer.android.com/training/in-app-billing/list-iab-products.html#QueryDetails
You have to do below things.
establish the connection between your app and google play app.
Get the list of products which is register in your google console.
prapare arraylist that contains product's id name and put into Bundle
code to get purchase
ArrayList<String> skuList = new ArrayList<String> ();
skuList.add("premiumUpgrade");
skuList.add("gas");
Bundle querySkus = new Bundle();
querySkus.putStringArrayList(“ITEM_ID_LIST”, skuList);
finaly one methode is reday in google_play_app that we need to call
Bundle skuDetails = mService.getSkuDetails(3,
getPackageName(), "inapp", querySkus);
call the getSkuDetails method on the In-app Billing Version 3 API, and pass the method the In-app Billing API version (“3”), the package name of your calling app, the purchase type (“inapp”), and the Bundle is our response
extract the bundle and get the product names and display it in ativity.
My paid iOS app is under review to be released only in the Japan App Store. I'd like to create the free version with a link to paid version, but don't have the URL of the paid version.
http://itunes.apple.com/linkmaker/ is mentioned in this question, but when I search for my app there, it doesn't show up.
Another option suggested is to create a permalink on our domain, but that will force the user through extra redirects.
iTunes connect gives my app url as starting with "http://itunes.apple.com/us/app/dumi-shuki-ying-yu/" Clicking that link gives a warning that it's the app is currently only available in the US (though we released it only for Japan).
I have the SKU and bundle ID, but what can I use for the URL?
This works on my end (Xcode 5 - iOS 7 - Device!):
itms-apps://itunes.apple.com/app/idYOUR_APP_ID
Code snippet (you can just copy& paste it):
#define YOUR_APP_STORE_ID 123456789 // Change this one to your app ID (get it from iTunes Connect)
static NSString *const iOS7AppStoreURLFormat = #"itms-apps://itunes.apple.com/app/id%#";
[NSURL URLWithString:[NSString stringWithFormat:iOS7AppStoreURLFormat, YOUR_APP_STORE_ID]]; // Would contain the right link
Pay attention that we didn't use the app name (isn't needed and it is bad to use because it's subject to change). On iOs 7 you can also use "http" instead of "itms-apps" and that would have same result (won't open safari first like on older OS).
Last important thing is that we haven't used the country data on the link (usually "us" or any other) so the device would select the relevant one. If you do write "us" on the link (like the one you get from iTunes Link Maker) if you open that on Japanese device if could show an alert because store is probably set to Japan and won't open the link.
The link you get in iTunes Connect should work just by replacing http:// with itms-apps://.
That being said this alert is strange, do you have anything linked to your iTunes account set to U.S English? I'm guessing this is just automatic, and once your app is approved this link should work provided the user that clicks the link's iTunes account is associated with the Japanese store.