Skip to content

Instantly share code, notes, and snippets.

View Duraiamuthan's full-sized avatar

Durai Amuthan Duraiamuthan

View GitHub Profile
@Duraiamuthan
Duraiamuthan / JSON deserialization
Created April 21, 2014 16:01
NSData(JSON) to Objective C Object
NSData *dataJSON;
dataJSON=service output;
NSArray *arr=[NSJSONSerialization JSONObjectWithData:dataJSON options:kNilOptions error:&jsonParsingError];
@Duraiamuthan
Duraiamuthan / JSON serialization
Created April 21, 2014 16:03
Objective c object to json string serialization
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:ObjcObject options:NSJSONWritingPrettyPrinted error:&writeError];
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
@Duraiamuthan
Duraiamuthan / NSString+UrlEncode
Created April 21, 2014 16:08
Objective C UrlEncode Category
//header
@interface NSString (UrlEncode)
- (NSString *)urlencode;
@end
//implementation
#import "NSString+UrlEncode.h"
@Duraiamuthan
Duraiamuthan / CommonFunctions
Created April 21, 2014 16:14
Objective C CommonFunctions
//Header
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
#import "NSString+UrlEncode.h"
@interface CommonFunctions:NSObject
+(void)MakeIOS6StyleStatusBar:(UIView*)vu;
@Duraiamuthan
Duraiamuthan / GeoLocation
Last active August 29, 2015 14:00
Objective C GeoLocations finder
//Header
#import <Foundation/Foundation.h>
#import "CoreLocation/CoreLocation.h"
@interface GeoLocation : NSObject<CLLocationManagerDelegate,UIAlertViewDelegate>
{
CLLocationManager *locationManager;
double latitude;
double longitude;
}
@Duraiamuthan
Duraiamuthan / MapAnnotation
Last active August 29, 2015 14:00
iOS Map Annotation
//header
@interface MKAnnotation : NSObject<MKAnnotation>
@property (strong, nonatomic) NSString *title;
@property (strong, nonatomic) NSString *subtitle;
@property (nonatomic,assign) CLLocationCoordinate2D coordinate;
-(id) initWithCoordinate:(CLLocationCoordinate2D)Coordinate title:(NSString *)Title andsubTitle:(NSString*)Subtitle;
@end
//implementation
@Duraiamuthan
Duraiamuthan / AddAnnotation
Last active August 29, 2015 14:00
AddAnnotation in Mapview
-(void)MarkMapwithLat:(NSString*)lat withLong:(NSString*)longi
{
NSLog(@"Latitude:%@ Longitude:%@",lat,longi);
CLLocationCoordinate2D coord=CLLocationCoordinate2DMake(lat.floatValue,longi.floatValue);
MKAnnotation *annotation=[[MKAnnotation alloc]initWithCoordinate:coord title:self.Name andsubTitle:customerSnippet];
MKCoordinateRegion viewRegion=MKCoordinateRegionMakeWithDistance(coord,500,500);
#!/bin/bash
# https://gist.github.com/949831
# http://blog.carbonfive.com/2011/05/04/automated-ad-hoc-builds-using-xcode-4/
# command line OTA distribution references and examples
# http://nachbaur.com/blog/how-to-automate-your-iphone-app-builds-with-hudson
# http://nachbaur.com/blog/building-ios-apps-for-over-the-air-adhoc-distribution
# http://blog.octo.com/en/automating-over-the-air-deployment-for-iphone/
# http://www.neat.io/posts/2010/10/27/automated-ota-ios-app-distribution.html
@Duraiamuthan
Duraiamuthan / gist:d6dc27b954ca348d494f
Created October 28, 2014 17:11
KeychainUtils for storing and getting credentials
//SFHFKeychainUtils.h
#import <UIKit/UIKit.h>
@interface SFHFKeychainUtils : NSObject {
}
+ (NSString *) getPasswordForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error;
+ (BOOL) storeUsername: (NSString *) username andPassword: (NSString *) password forServiceName: (NSString *) serviceName updateExisting: (BOOL) updateExisting error: (NSError **) error;
CFUUID
CFUUID is available from iOS 2.0. CoreFoundation package (C style API) provide CFUUID. CFUUIDCreate is the method to create the CFUUIDRef and can get an NSString representation of the created CFUUIDRef like :-
CFUUIDRef cfuuid = CFUUIDCreate(kCFAllocatorDefault);
NSString *cfuuidString = (NSString*)CFBridgingRelease(CFUUIDCreateString(kCFAllocatorDefault, cfuuid));
CFUUID is not persisted, every time you call CFUUIDCreate and will get new unique identifier.
e.g. 68883Q11-4D23-5434-9D60-2250E4C90967