Posts

Showing posts from January, 2014

Unique Identifier UUID - iOS

UDID is a hash value composed from various hardware identifiers such as the device serial number. It is unique for each device.  The UDID is independent of the device name, SIM card. It is really easy to get it from the device programmatically: NSString *uuid =  [[UIDevice currentDevice] uniqueIdentifier]; But UDID is no longer available onwards iOS 6 due to security / privacy reasons. UDID is deprecated by Apple; developers can not make use of it in any iOS application. So what now?  How can we identify the device? I found many solutions on searching over internet like  identifierForVendor or  advertisingIdentifier or generate our own UUID (store & persist it on your own). Many examples show how to generate UUID and store it in NSUserDefault: -( NSString *)generateUUID {     NSString *CFUUID = nil ;     if ([[ NSUserDefaults standardUserDefaults ] valueForKey : @"UUID" ] == nil ) {         CFUUIDRef uuid = CFUUIDCreate ( kCFAllocatorDef

Upload Multiple Images/Photos to Server Using MulipartFormatData via AFNetworking

Below is the code snippet which would help in uploading multiple Images along with Text to Server: -(void)uploadMultipleImagesWithTextMessageUsingAFNetworkingMultipartFormat:(id)sender {     // Upload multiple images to server using multipartformatdata (AFNetworking)         NSString *stringMessage = @"I am uploading multiple images to server";           AFHTTPClient *client = [[AFHTTPClient alloc] initWithBaseURL: [NSURL URLWithString:BASEURL]]; // replace BASEURL     client.parameterEncoding = AFJSONParameterEncoding;     NSMutableURLRequest *request = [client multipartFormRequestWithMethod:@"POST" path:@"/PostMultImagesWithTextAPI" parameters:nil constructingBodyWithBlock: ^(id <AFMultipartFormData>formData) {                 [formData appendPartWithFormData:[[[NSUserDefaults standardUserDefaults] objectForKey:KServerAccessToken] dataUsingEncoding:NSUTF8StringEncoding] name:@"AccessToken"];                 [formData appen