IOS UniqueIdentifier in ios 7 (xCode 5)

Sometime when creating app for ios, you will want to get an UniqueIdentifier for each device (which is usually called IMEI in other phone), however in iOS, you cannot get the device IMEI easily, instead we will use the UniqueIdentifier with this syntax:

NSString *UDID = [[UIDevice currentDevice] uniqueIdentifier];

This method is simple, but when Apple release an iOS 7 (and xCode 5), the code above will not work, instead it give us an compiler error like this:

No visible @interface for 'UIDevice' declares the selector 'uniqueIdentifier'

This is annoying and sad that Apple is such an asshole, developing app for ios is far, far more complicated compare to Android (in my opinion) due to it sand-box rule. And every time it update, there's a chance we will have to fix our app, remove some functions, change some methods...etc...

The solution I use temporary is this line of code:

NSString *UDID = [[UIDevice currentDevice] performSelector:@selector(uniqueIdentifier)];

Comments

Popular posts from this blog

No visible @interface for class declares the selector

SFML - Lập trình game - Cài Đặt