Is there any API to find MCC for iPhone? [duplicate] - iphone

As per the subject - is there an API to get the MCC/MNC on iPhone OS 2.1 or above?

Added in iOS4
CTTelephonyNetworkInfo *netInfo = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier *carrier = [netInfo subscriberCellularProvider];
NSString *mcc = [carrier mobileCountryCode];
NSString *mnc = [carrier mobileNetworkCode];
http://developer.apple.com/library/ios/#Documentation/NetworkingInternet/Reference/CTCarrier/Reference/Reference.html

No, mobile network information is not available through the API. If you're looking for a unique device ID, take a look at UIDevice's uniqueIdentifer method; if you're looking for the country the device is in, you need Location Services; if you want a good indication of the user's home region, take a look at NSLocale; for anything else, just ask the user.

I think you could just get the phone number of the iPhone and parse it out for the country code.

Related

Share gifts with FB SDK iOS

I am having a problem making gifts (pack of coins, lives, etc). I have been using this guide.
I think I did everything correctly at https://developers.facebook.com/, created the coin type, made the object and used its id.
This is my code for request:
FBSDKGameRequestContent *gameRequestContent = [[FBSDKGameRequestContent alloc] init];
gameRequestContent.message = #"Take this coins";
gameRequestContent.title = #"Choose users";
gameRequestContent.filters = FBSDKGameRequestFilterAppUsers;
gameRequestContent.actionType = FBSDKGameRequestActionTypeSend;
gameRequestContent.objectID = #"386681778192859";
[FBSDKGameRequestDialog showWithContent:gameRequestContent delegate:self];
My question is how I can take a message or a callback from this request at another device. I was looking for a solution at facebook site, but I didn't find anything. In general, is it possible or do I have to make custom server?

Can I get list of my company's installed apps on device?

I want to know that is it possible in iOS that one could get list of installed applications uploaded by same company?? If yes, then what would be the code???
I know that it's restricted to get list of installed apps in iOS. But I want to know that which of my applications are installed on user's device? So, does Apple allows to get list of own installed apps??
If you did some planning in advance and gave each app it's own URL scheme then you could check if each scheme in turn was openable by the app and count the number that were. But if your apps don't have defined schemes then no, you can't.
Well for the Second part of your question. Yes you can get the list of apps installed in your device using
-(void) allInstalledApp
{
NSDictionary *cacheDict;
NSDictionary *user;
static NSString *const cacheFileName = #"com.apple.mobile.installation.plist";
NSString *relativeCachePath = [[#"Library" stringByAppendingPathComponent: #"Caches"] stringByAppendingPathComponent: cacheFileName];
NSString *path = [[NSHomeDirectory() stringByAppendingPathComponent: #"../.."] stringByAppendingPathComponent: relativeCachePath];
cacheDict = [NSDictionary dictionaryWithContentsOfFile: path];
user = [cacheDict objectForKey: #"User"];
NSDictionary *systemApp=[cacheDict objectForKey:#"System"];
}
The systemApp Dictionary contains the list of all system related app and user Dictionary contains other app information.
According to your First part of the question , you cannot directly get the list of apps for a particular company . But You could show a constant URL of the Apple store site to the user in a UIWebView or outside the app in Safari . This URL would have the list of all the apps. Also if you have the list of the URL's your app's loaded on the Apple store . then you could show them individually in the browser too.
no, nothing You ask is possible, of technical and local reasons.
You can see some details only on YOUR devices you configured with IPCU or similar tools, (MDMs..) but not in code.

IOS - How to determine carrier name of phone numbers and last call charge for outgoing call in iPhone

Can anyone please tell me how to find out the last call charge of an outgoing call and the carrier name of an outgoing call phone number? Is there an API for getting the details of the carrier name and call cost in an iPhone?
It is not even about confidentiality or security, although if this info was available, it would be a serious security concern.
The phone does not understand anything related to billing in a wireless/cellular network. The phone just tries to register on a network, but if the account is inactive or not in good standing, the network will generally reject an attempt to register.
Billing is pretty much handled by the operator's core network (usually the MSC in a circuit switched network, SGSN in a UMTS packet switched network, PDSN in a CDMA/EVDO packet switched network, or the MME in an LTE packet switched network), so it is impossible to get any information on remaining minutes or costs related to a phone call or data transfers. Any app that provides this information usually does it by approximating it. Usually it just tracks this info on the phone-level and it may not be official.
The Carrier Name might be available depending on the provider and the technology. In most technologies, the MCC & MNC of the network will be available, and you can access that carrier name. This link gives you an idea of how to do it for iOS4, but the short version is:
#import <CoreTelephony/CTCarrier.h>
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
// Setup the Network Info and create a CTCarrier object
CTTelephonyNetworkInfo *networkInfo = [[[CTTelephonyNetworkInfo alloc] init] autorelease];
CTCarrier *carrier = [networkInfo subscriberCellularProvider];
// Get carrier name
NSString *carrierName = [carrier carrierName];
if (carrierName != nil)
NSLog(#"Carrier: %#", carrierName);
// Get mobile country code
NSString *mcc = [carrier mobileCountryCode];
if (mcc != nil)
NSLog(#"Mobile Country Code (MCC): %#", mcc);
// Get mobile network code
NSString *mnc = [carrier mobileNetworkCode];
if (mnc != nil)
NSLog(#"Mobile Network Code (MNC): %#", mnc);
No there isn't. No there shouldn't be. No there can't be. That stuff is confidential.

iOS iTunes store country

i am wondering if there is a solution to find out, in which country the user downloaded an application.
For example: app x has been downloaded in USA when the user opens up the app, the app will check in which country it was downloaded. In this example the the return would be "USA"
Does any one hase an idea on how to solve this?
If you have any In-App Purchases available, you can read the locale from the SKProduct. As a fallback, use the device's locale.
NSLocale *locale;
SKProduct *baseProduct = nil; // replace as applicable
if (baseProduct) {
locale = baseProduct.priceLocale; // from the user's credit card on iTunes
} else {
locale = [NSLocale currentLocale]; // from user preferences
}
NSString *countryCode = [locale objectForKey:NSLocaleCountryCode];
NSLog(#"Two-letter country code: %#", countryCode);
There might be a good enough correlation between the iTunes store country and the locale a user sets. This depends on your needs - if this does not suffice, I don't think there is a way to know which actual store an app was downloaded from.
To retrieve that locale, you could use:
NSString *localeIdentifier = [[NSLocale currentLocale] localeIdentifier];
Hope this is sufficient for your needs.
It's not possible to check "which" App Store an app was downloaded.
If you need to do anything location-based, you should look at CLLocation to obtain a user's current location, however it may seem intrusive for the app to ask a user for their location if it's not apparent why it would need the location.
You could also check for the language on a users device, such as en_gb for Britain, dk for Denmark, en_ca for Canada, etc. While this doesn't completely cover when people in some countries have set the language to something else than the countries native language, it's better than nothing.
SKStoreFront, introduced in iOS 13 SDK seems to do the job.
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.

Get iPhone Carrier Reception Status? (not internet)

I need to know if the user could theoretically make a phone call.
Does anyone know how to "return true" (using Cocoa iOS) when the user's iPhone is able to connect to the carrier's network? (not the internet)
Or how to programmatically tell "how many bars of reception" the user has?
Link your application against the CoreTelephony.framework
You can check the CTCarrier object and see if you've a valid result (!=nil) for some property that require a connection with the Phone Provider.
For example, below there's a snip of code that check against the mobileNetworkCode property of CTCarrier. This property is != nil if-and-only-if the device is connected to a Phone Provider (your desired task, user able to make a phone call, is included in the state described above).
CTTelephonyNetworkInfo *netInfo = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier *carrier = [netInfo subscriberCellularProvider];
//The value for this property is nil if any of the following apply:
// - The device is in Airplane mode.
// - There is no SIM card in the device.
// - The device is outside of cellular service range.
NSString *mnc = [carrier mobileNetworkCode];
if(!mnc) {
//if we're here, than probably we're disconnected from the Phone Provider
}
netInfo.subscriberCellularProviderDidUpdateNotifier = ^ (CTCarrier * carrier) {
//this block is executed each time we've a change to the state of the carrier
//be sure to check the carrier object, in order to see is we're connected to a
//phone provider.
};
more info at the Apple Developer Documentation url: http://developer.apple.com/library/IOs/#documentation/NetworkingInternet/Reference/CTCarrier/Reference/Reference.html