Posts

Showing posts from November, 2013

code for sending & recievieng the data to the server through Get and Post method in xcode

.h file @interface ConnectionExampleViewController : UIViewController @property ( retain , nonatomic ) NSURLConnection *connection; @property ( retain , nonatomic ) IBOutlet UIButton *btn_post; @property ( retain , nonatomic ) IBOutlet UIButton *btn_get; @property ( retain , nonatomic ) NSMutableData *receivedData; -( IBAction )btn_get_clicked:( id )sender; -( IBAction )btn_post_clicked:( id )sender; .m file -( IBAction )btn_get_clicked:( id )sender {     NSMutableURLRequest *request = [[ NSMutableURLRequest alloc ] init ] ;     NSString *urlString = @"http://www.example.com/command=18&email=email&exchanges=hong%20kong%20Stock%20Exchange&instrumentclass=Stock&payforservice=YES&country=china" ;     [request setURL :[ NSURL URLWithString :urlString]];     [request setHTTPMethod : @"GET" ];     NSString *type = [ NSString stringWithFormat : @"application/x-www-fo...

Code for opening the url in safari browser in Xcode

 code for opening and navigation of the specified url into the browser NSString *wikiUrl = @"http://www.google.com" ;     [[ UIApplication sharedApplication ] openURL :[ NSURL URLWithString :wikiUrl]]; }

Find the dot in the string in xcode and remove content after dot (.)

Find the dot in the string in xcode and remove content after dot (.) This will help you to remove the content after and before  dot (.)   user  id =user@abc.com           NSUserDefaults   *standardUserDefaults2 = [ NSUserDefaults   standardUserDefaults ];       userLogedIn = [standardUserDefaults2 objectForKey : @"useremail2" ];       [ userLogedIn stringByReplacingOccurrencesOfString : @"." withString : @"" ];         NSRange range = [ userLogedIn rangeOfString : @"." ];        userLogedIn = [ userLogedIn substringWithRange : NSMakeRange ( 0 , range. location )];        NSLog ( @"user id==>%@" , userLogedIn ); Output: user@abc