Get UUID
Objective-C defines a small but powerful set of extensions to the ANSI C programming language that enables sophisticated object-oriented programming. Objective-C is the native language for Cocoa programming—it’s the language that the frameworks are written in, and the language that most applications are written in. You can also use some other languages—such as Python and Ruby—to develop programs using the Cocoa frameworks. It’s useful, though, to have at least a basic understanding of Objective-C because Apple’s documentation and code samples are typically written in terms of this language.
Sometimes you might need to getting UUID on your iPhone or iPad app. There are many ways to accomplish this task and I would like to discuss one of the ways we are using here at Walden Systems, because we believe this is the most straightforward method to getting UUID.
Strategy to getting UUID is fairly simple: First, we need to declare a NSString to hold the UUID. Second, we need to use UIDevice object to get UUID.
Here are actual code samples:
The first thing you need to do is to declare a NSString to hold the UUID to do so, use the following line:
NSString * str ;
Theny you need to use UIDevice object to get UUID.
str = [ [ [ UIDevice currentDevice ] identifierForVendor ] UUIDString ] ;
So, this is how get UUID will look like:
1 NSString * str ; 2 str = [ [ [ UIDevice currentDevice ] identifierForVendor ] UUIDString ] ;