Ios7 App Backward Compatible with iOS5 Regarding Unique Identifier

iOS7 app backward compatible with iOS5 regarding unique identifier

The best and recommend option by Apple is:

 NSString *adId = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];

Use it for every device above 5.0.

For 5.0 you have to use uniqueIdentifier. The best to check if it's available is:

if (!NSClassFromString(@"ASIdentifierManager"))

Combining that will give you:

- (NSString *) advertisingIdentifier
{
if (!NSClassFromString(@"ASIdentifierManager")) {
SEL selector = NSSelectorFromString(@"uniqueIdentifier");
if ([[UIDevice currentDevice] respondsToSelector:selector]) {
return [[UIDevice currentDevice] performSelector:selector];
}
//or get macaddress here http://iosdevelopertips.com/device/determine-mac-address.html
}
return [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
}

Uniquely identifying user across app installs/uninstalls for iOS7

You can create a UUID and write it to the keychain,that persists across installs.

How to get Device UDID in programmatically in iOS7?

It's work 100% to all the version

other best option recommend by apple use ASIdentifierManager Class Reference

ios7-app-backward-compatible-with-ios5-regarding-unique-identifier

this link tell you how to handle and use custom framework

uidevice-uniqueidentifier-property-is-deprecated-what-now

iOS 9

NSUUID *uuid = [[NSUUID alloc]initWithUUIDString:@"20B0DDE7-6087-4607-842A-E97C72E4D522"];
NSLog(@"%@",uuid);
NSLog(@"%@",[uuid UUIDString]);

or

it support only ios 6.0 and above

code to use [[[UIDevice currentDevice] identifierForVendor] UUIDString];

NSUUID *deviceId;
#if TARGET_IPHONE_SIMULATOR
deviceId = [NSUUID initWithUUIDString:@"UUID-STRING-VALUE"];
#else
deviceId = [UIDevice currentDevice].identifierForVendor;
#endif

ios 5 to use like

 if ([[UIDevice currentDevice] respondsToSelector:@selector(identifierForVendor)]) {
// This is will run if it is iOS6
return [[[UIDevice currentDevice] identifierForVendor] UUIDString];
} else {
// This is will run before iOS6 and you can use openUDID or other
// method to generate an identifier
}

Is Xcode 5 Asset Catalog backwards compatible with pre-iOS 7?

Yes, it is backwards compatible.

The documentation says:

Xcode 5 provides different functionality for asset catalogs depending
on the deployment target for your project:

  • For all projects, individual images can be loaded using set names.
  • For projects with a deployment target of iOS 7, Xcode compiles your asset catalogs into a runtime binary file format that reduces the
    download time for your app.

The new binary file format is only used if your deployment target is set to iOS 7. Otherwise it defaults back to simply putting all of the individual image files into your resources folder, as before.

Swift with iOS 5 deployment target

From one of the engineers working on Swift, iOS 7, Mavericks and later:

Sample Image



Related Topics



Leave a reply



Submit