Search Results

Search found 605 results on 25 pages for 'stringwithformat'.

Page 6/25 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • String formatting in cocoa

    - by lostInTransit
    Hi I am trying to send some text in an email from my cocoa app (by using Mail.app). Initially I tried using HTML to send properly formatted text. But the mailto: URL does not support html tags (even after setting headers) So I decided to use formatted string (left-aligning of string) This is what I have in my mailto: link's body argument NSMutableString *emailBody = [NSMutableString stringWithFormat:@"|%-35s", [@"Name" UTF8String]]; [emailBody appendFormat:@"|%-18s", [@"Number" UTF8String]]; [emailBody appendString:@"|Notes\n"]; [emailBody appendString:@"----------------------------------------------------------------------------------------------------"]; for(int i = 0; i < [items count]; i++){ NSDictionary *props = [items objectAtIndex:i]; NSMutableString *emailData = [NSMutableString stringWithFormat:@"|%-35s", [[props valueForKey:@"name"] UTF8String]]; [emailData appendFormat:@"|$ %-16s", [[props valueForKey:@"number"] UTF8String]]; [emailData appendString:[props valueForKey:@"notes"]]; [emailBody appendString:@"\n"]; [emailBody appendString:emailData]; } This does give me padded text but they all don't necessarily take up the same space (for instance if there is an O in the text, it takes up more space than others and ruins the formatting) Is there another sure-shot way to format text using just NSString? Thanks

    Read the article

  • strange multiple files download - NSURLConnection

    - by Georg
    hi all, I encounter a problem by following your comment. I would like to download different file at same time with different delegate: .h: NSMutableData *fileData; .m: NSString *imgfile = [NSString stringWithFormat:@"http://xxxx/01.jpg"]; NSURL *fileURL1 = [NSURL URLWithString:imgfile]; NSString *audiofile = [NSString stringWithFormat:@"http://xxxx/01.mp3"]; NSURL *fileURL2 = [NSURL URLWithString:audiofile]; NSURLRequest *request1 = [NSURLRequest requestWithURL:fileURL1 cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10.0 ]; NSURLRequest *request2 = [NSURLRequest requestWithURL:fileURL2 cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10.0 ]; NSArray *connections = [[NSArray alloc] initWithObjects: [[NSURLConnection alloc] initWithRequest:request1 delegate:self ], [[NSURLConnection alloc] initWithRequest:request2 delegate:self ], nil]; - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { fileData = [[NSMutableData alloc] init]; } - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [fileData appendData:data]; } - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { NSLog(@"Unable to fetch data"); } ok, the download process works, but, the file size of jpg and mp3 are incorrect, the only correct thing is the total file size (jpg+mp3), please could you have a look on the code, what is missing? Another question is, I put the file in a NSMutableArray, my question is, how to check which index of array is the correct file type (jpg and mp3)? because I need to save them to the device folder.

    Read the article

  • NSURLErrorBadURL error

    - by Victor jiang
    My iphone app called Google Local Search(non javascript version) to behave some search business. Below is my code to form a url: NSString *url = [NSString stringWithFormat:@"http://ajax.googleapis.com/ajax/services/search/local?v=1.0&q=%@", keyword]; NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:[NSURL URLWithString:url]]; [request setHTTPMethod:@"GET"]; //get response NSHTTPURLResponse* urlResponse = nil; NSError *error = [[[NSError alloc] init] autorelease]; NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&error]; NSString *result = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; When the keyword refers to english characters, it works fine, but when refers to chinese characters(encoded in UTF8, such as '???' whose UTF8 code is 'e5a4a9 e5ae89 e997a8'), it will report NSURLErrorBadURL error(-1000, Returned when a URL is sufficiently malformed that a URL request cannot be initiated). Why? Then I carry out further investigation, I use Safari and type in the url below: http://ajax.googleapis.com/ajax/services/search/local?v=1.0&q=??? It also works, and the output I got from Macsniffer is: /ajax/services/search/local?v=1.0&q=%E5%A4%A9%E5%AE%89%E9%97%A8 So I write a testing url directly in my app NSString *url = [NSString stringWithFormat:@"http://ajax.googleapis.com/ajax/services/search/local?v=1.0&q=%E5%A4%A9%E5%AE%89%E9%97%A8"]; And what I got from the Macsniffer is some other thing: /ajax/services/search/local?v=1.0&q=1.687891E-28750X1.417C0001416CP-102640X1.4CC2D04648FBP-9999-1.989891E+0050X1.20DC00184CC67P-953E8E99A8 It seems my keyword "%E5%A4%A9%E5%AE%89%E9%97%A8" was translated into something else. So how can I form a valid url? I do need help!

    Read the article

  • why AVAudioplayer doesn't stop/pause when viewWillDisappear?

    - by Rahul Vyas
    I am using avaudioplayer in my app. on viewwilldisappear i want to pause/stop the sound and on viewwill appear i want to play sound again.how do i do this? i'm using this code on viewWillAppear:- if(self.TickPlayer) { [self.TickPlayer play]; } if(self.TickPlayer.volume<0) { self.TickPlayer.volume=1.0; } and this on viewWillDisAppear if(self.TickPlayer) { [self.TickPlayer stop]; } here is the method which plays the sound -(void)PlayTickTickSound:(NSString*)SoundFileName { //Get the filename of the sound file: NSString *path = [NSString stringWithFormat:@"%@%@",[[NSBundle mainBundle] resourcePath],[NSString stringWithFormat:@"/%@",SoundFileName]]; //Get a URL for the sound file NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO]; NSError *error; if(self.TickPlayer==nil) { self.TickPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:filePath error:&error]; // handle errors here. self.TickPlayer.delegate=self; [self.TickPlayer setNumberOfLoops:-1]; // repeat forever [self.TickPlayer play]; } if(self.TickPlayer) { [self.TickPlayer play]; } } and i'm calling it in method which fires every second using a timer in viewDidLoad- self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateCountdown) userInfo:nil repeats:YES]; -(void) updateCountdown { [self PlayTickTickSound:@"tick.caf"]; } i'm also playing a beep sound using avaudioplayer at a specific condition when alert appears.that works fine but this is not working as expected

    Read the article

  • Trouble getting NSString from NSDictionary key into UILabel

    - by Brian
    I'm attempting to put the value associated with the key called "duration" into a UILabel but I'm getting a blank or "(null)" result showing up in the UILabel. My NSDictionary object with its keys seems to be logging as being full of the data and keys I think I want, as such: the content of thisRecordingsStats is { "12:48:25 AM, April 25" = { FILEPATH = "/Users/brian/Library/Application Support/iPhone Simulator/3.1.3/Applications/97256A91-FC47-4353-AD01-15CD494060DD/Documents/12:48:25 AM, April 25.aif"; duration = "00:04"; applesCountString = 0; ...and so on. Here's the code where I'm trying to put the NSString into the UILabel: cell.durationLabel.text = [NSString stringWithFormat:@"%@",[thisRecordingsStats objectForKey:@"duration"]]; I've also tried these other permutations: cell.durationLabel.text = [thisRecordingsStats objectForKey:@"duration"]; and I've also tried this tag-based approach: label = (UILabel *)[cell viewWithTag:8]; label.text = [[thisRecordingsStats objectForKey:@"duration"] objectAtIndex:1]; and: UILabel *label; label = (UILabel *)[cell viewWithTag:8]; label.text = [NSString stringWithFormat:@"%@",[[thisRecordingsStats objectForKey:@"duration"] objectAtIndex:1]]; I've also tried creating a string from the key's paired value and see a "(null)" value or blankness using that too. What am I missing? I assume it's something with the formatting of the string. Thanks for looking!!

    Read the article

  • Sending hidden fields via POST in iPhone in-app email

    - by Michael
    I'm letting my App's user send email from within the app to share some content on myserver. To do so I need to include a button with two bits of data and I want to use POST to keep it somewhat hidden. I've decided to add an html form using POST and two hidden fields in the email rather, like so: NSString *buttonCode = [NSString stringWithFormat:@"<form method='post' action='http://www.example.com/iphone/nifty.php'> <input type='hidden' name='dataOne' value='%@'> <input type='hidden' name='dataTwo' value='%@'> <input type='submit'value='Submit'></form>",dataOne, dataTwo]; NSString *emailBody = [NSString stringWithFormat: @"<b>%@ - %@</b>\n\n<HR WIDTH=200 SIZE=2 COLOR=#755f0f ALIGN=CENTER>\n Here is a email:<br><br>%@", dateString, timeString, buttonCode]; [picker setMessageBody:emailBody isHTML:YES]; I've confirmed by looking at the raw source of the email that the form is constructed correctly and I've copied and pasted it into a web page and it works. So here is the problem. When I click on the button in the received email (using apple's mail client) the dataOne and dataTwo variables don't get passed to my server. Is there a better way to do this or is the issue with my mail client?

    Read the article

  • NSMutableArray to NSString and Passing NSString to Another View IOS5.1

    - by Space Dust
    I have an NSMutableArray of names. I want the pass the data (selected name) inside of NSMutableArray as text to another view's label. FriendsController.m: - (void)viewDidLoad { [super viewDidLoad]; arrayOfNames=[[NSMutableArray alloc] init]; arrayOfIDs=[[NSMutableArray alloc] init]; userName=[[NSString alloc] init]; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { long long fbid = [[arrayOfIDs objectAtIndex:indexPath.row]longLongValue]; NSString *user=[NSString stringWithFormat:@"%llu/picture",fbid]; [facebook requestWithGraphPath:user andDelegate:self]; userName=[NSString stringWithFormat:@"%@",[arrayOfNames objectAtIndex:indexPath.row]]; FriendDetail *profileDetailName = [[FriendDetail alloc] initWithNibName: @"FriendDetail" bundle: nil]; profileDetailName.nameString=userName; [profileDetailName release]; } - (void)request:(FBRequest *)request didLoad:(id)result { if ([result isKindOfClass:[NSData class]]) { transferImage = [[UIImage alloc] initWithData: result]; FriendDetail *profileDetailPicture = [[FriendDetail alloc] initWithNibName: @"FriendDetail" bundle: nil]; [profileDetailPicture view]; profileDetailPicture.profileImage.image= transferImage; profileDetailPicture.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; [self presentModalViewController:profileDetailPicture animated:YES]; [profileDetailPicture release]; } } In FriendDetail.h NSString nameString; IBOutlet UILabel *profileName; @property (nonatomic, retain) UILabel *profileName; @property (nonatomic, retain) NSString *nameString; In FriendDetail.m - (void)viewDidLoad { [super viewDidLoad]; profileName.text=nameString; } nameString in second controller(FriendDetail) returns nil. When i set a breakpoint in firstcontroller I see the string inside of nameString is correct but after that it returns to nil somehow.

    Read the article

  • AVAudioRecorder Won't Record On Device

    - by Dyldo42
    This is my method: -(void) playOrRecord:(UIButton *)sender { if (playBool == YES) { NSError *error = nil; NSString *filePath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat: @"%d", [sender tag]] ofType:@"caf"]; NSURL *fileUrl = [NSURL fileURLWithPath:filePath]; AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:fileUrl error:&error]; [player setNumberOfLoops:0]; [player play]; } else if (playBool == NO) { if ([recorder isRecording]) { [recorder stop]; [nowRecording setImage:[UIImage imageNamed:@"NormalNormal.png"] forState:UIControlStateNormal]; [nowRecording setImage:[UIImage imageNamed:@"NormalSelected.png"] forState:UIControlStateSelected]; } if (nowRecording == sender) { nowRecording = nil; return; } nowRecording = sender; NSError *error = nil; NSString *filePath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat: @"%d", [sender tag]] ofType:@"caf"]; NSURL *fileUrl = [NSURL fileURLWithPath:filePath]; [sender setImage:[UIImage imageNamed:@"RecordingNormal.png"] forState:UIControlStateNormal]; [sender setImage:[UIImage imageNamed:@"RecordingSelected.png"] forState:UIControlStateSelected]; recorder = [[AVAudioRecorder alloc] initWithURL:fileUrl settings:recordSettings error:&error]; [recorder record]; } } Most of it is self explanatory; playBool is a BOOL that is YES when it is in play mode. Everything works in the simulator however, when I run it on a device, [recorder record] returns NO. Does anyone have a clue as to why this is happening?

    Read the article

  • wait for CLLocationManager to finish before tweeting

    - by user295944
    I want to wait for latitude.text and longtitude.text to be filled in before sending a tweet, this code works fine, but I would rather not put the tweeting part in locationManager because I also want to sometimes update the current location without sending a tweet. How can I make sure the txt gets filled in before sending the tweet without doing this? - (IBAction)update { latitude.text =@""; longitude.text =@""; locmanager = [[CLLocationManager alloc] init]; [locmanager setDelegate:self]; [locmanager setDesiredAccuracy:kCLLocationAccuracyBest]; [locmanager startUpdatingLocation]; } - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { CLLocationCoordinate2D location = [newLocation coordinate]; latitude.text = [NSString stringWithFormat: @"%f", location.latitude]; longitude.text = [NSString stringWithFormat: @"%f", location.longitude]; TwitterRequest * t = [[TwitterRequest alloc] init]; t.username = @"****"; t.password = @"****"; [twitterMessageText resignFirstResponder]; loadingActionSheet = [[UIActionSheet alloc] initWithTitle:@"Posting To Twitter..." delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; [loadingActionSheet showInView:self.view]; [t statuses_update:twitterMessageText.text andLat:latitude.text andLong:longitude.text delegate:self requestSelector:@selector(status_updateCallback:)]; twitterMessageText.text=@""; }

    Read the article

  • What is the best way to move a UIToolbar?

    - by Ferdinand Rios
    Here is an interesting problem. On the iPhone, I have a view set up that has a toolbar on the bottom of the screen. I am currently trying to make this a universal app so that it runs on iPad as well. I would like the toolbar to be at the top of the iPad screen, so in the viewDidLoad method of the specific viewController I have the following code. if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { //move the toolbar to the top of the page and move the webview down by the height of the toolbar CGRect toolBarFrame = self.aToolBar.frame; CGRect webFrame = self.aWebView.frame; webFrame.origin.y = toolBarFrame.size.height; [self.aWebView setFrame:webFrame]; toolBarFrame.origin.y = 0; [self.aToolBar setFrame:toolBarFrame]; [Utils errorString:[NSString stringWithFormat:@"origen: x=%f y=%f", self.aToolBar.frame.origin.x, self.aToolBar.frame.origin.y]]; [Utils errorString:[NSString stringWithFormat:@"origen: x=%f y=%f", self.aWebView.frame.origin.x, self.aWebView.frame.origin.y]]; } The problem I am having is that the webView moves down fine, but the toolbar only moves up to about what seems to be the height of a iPhone screen. The call to errorString tells me that the webView's origin is at 0,44 (where it should be) and that the toolbar's origin is at 0,0, but it is actually somewhere in the middle of the screen! Anybody have a clue what is going on here?

    Read the article

  • iPhone POST to PHP failing

    - by Alexander
    I have this code here: NSString *post = [NSString stringWithFormat:@"deviceIdentifier=%@&deviceToken=%@",deviceIdentifier,deviceToken]; NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:NO]; NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]]; NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:[NSURL URLWithString:@"http://website.com/RegisterScript.php"]]; [request setHTTPMethod:@"POST"]; [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; [request setValue:@"MyApp-V1.0" forHTTPHeaderField:@"User-Agent"]; [request setHTTPBody:postData]; NSData *urlData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; NSString *response = [[NSString alloc] initWithData:urlData encoding:NSASCIIStringEncoding]; which should be sending data to my PHP server to register the device into our database, but for some of my users no POST data is being sent. I've been told that this line: NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:NO]; may be causing the problem. Any thoughts on why this script would sometimes not send the POST data? On the server I got the packet trace for a failed send and the Content-lenght came up as 0 so no data was sent at all. Thanks for any help

    Read the article

  • how to set data into textfeild

    - by shishir.bobby
    hi all i have a table view containing some text. and an selecting a row, i hv to set text on another view's textfeild based on the selected index of row od table view. this is hoe it looks like -(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath { abc *abcController = [ [ abcController alloc] initWithNibName:@"abcController" bundle:[NSBundle mainBundle]]; [self.navigationController abcController animated:YES]; coffeeObj = [appdelegate.coffeeArray objectAtIndex:indexPath.row]; abcController.sender.text =[NSString stringWithFormat:@" to %@", coffeeObj.to]; abcController.mobileNumber.text = [NSString stringWithFormat:@" from %@", coffeeObj.from]; [abcController release]; } and this is how my textfeilds looks like, which is in table view if(indexPath.row == 0) textField.keyboardType = UIKeyboardTypeDefault; else textField.keyboardType = UIKeyboardTypePhonePad; textField.autocorrectionType = UITextAutocorrectionTypeNo; [cell.contentView addSubview:textField]; if(indexPath.row == 0) { self.sender = textField; cell.textLabel.text = NSLocalizedString(@"From :", @" "); NSLog(@"sender: %@", self.sender.text); } else { self.mobileNumber = textField; cell.textLabel.text = NSLocalizedString(@"To :" ,@" "); NSLog(@"mobile Number: %@", self.mobileNumber.text); } [textField release]; my problem is i am not abel to set text in these textfeilds from previous view..... plz let me knw where i am wrong..... w8ing for a quick reply.. regards shishir

    Read the article

  • Printing Pdf using AirPrint causes cut-off content

    - by Jatin Patel
    Here i am printing pdf with size 'pageSize = CGSizeMake(640, 832);'. this size is larget then A4 size page aspected. so i will cut-off some text(means it will not print whole page). while printing same pdf using MAC, it will print whole page with help of option (scale to fit). so can any one help me to come out from this problem.. is there any option in IOS sdk for scale to fit. here is my code.. -(void)printItem { NSArray *aArrPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) ; NSString *aStr = [[aArrPaths objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"PropertyReport_%d.pdf",self.propertyId]]; // NSString *aStr = [[NSBundle mainBundle] pathForResource:@"TRADUZIONE HELP SECTIONS REV2" ofType:@"pdf"]; NSURL *url=[[NSURL alloc] initFileURLWithPath:aStr]; NSData *data=[[NSData alloc] initWithContentsOfURL:url]; printController = [UIPrintInteractionController sharedPrintController]; if(printController && [UIPrintInteractionController canPrintData:data]) { printController.delegate = self; UIPrintInfo *printInfo = [UIPrintInfo printInfo]; printInfo.outputType = UIPrintInfoOutputGeneral; //printInfo.jobName = [NSString stringWithFormat:@"New Image"]; printInfo.duplex = UIPrintInfoDuplexLongEdge; printController.printInfo = printInfo; printController.showsPageRange = YES; printController.printingItem = data; void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *printController, BOOL completed, NSError *error) { if (!completed && error) { //NSLog(@"FAILED! due to error in domain %@ with error code %u", error.domain, error.code); } }; // aWebViewPDF.hidden=FALSE; [printController presentAnimated:YES completionHandler:completionHandler]; } } Thanks Jatin Patel

    Read the article

  • Troubleshooting FORM POST problems

    - by brettr
    I'm using the following code to submit to a WCF service. I keep getting an error that the key is invalid. I have a webpage on the same server that I submit the same data (but different key) using a FORM POST. It works fine that way. I put the URL below all in a URL (including valid key from server webpage) and get the key is invalid error. I'm thinking the data I'm submitting through the iPhone isn't really going across as a FORM POST but rather as a URL. Is there anything I may be doing wrong in the following code or any other suggestions? NSString *stringForURL = @"https://abc.com/someservice.aspx"; NSURL *URL=[[NSURL alloc] initWithString:stringForURL]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL]; NSString *request_body = [NSString stringWithFormat:@"prop1=value1&key=%@", [@"r2xHEuzgDTQEWA5Xe6+k9BSVrgsMX2mWQBW/39nqT4s=" stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; NSData *postData = [request_body dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]]; [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; [request setHTTPMethod:@"POST"]; [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; [request setHTTPBody:postData]; NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; [NSThread sleepForTimeInterval:1]; self.receivedData = [[NSMutableData data] retain];

    Read the article

  • How to customize the content of each page using Page Control and UIScrollView?

    - by viper15
    I have problem with customizing each page using pagecontrol and UIScrollView. I'm customizing Page Control from Apple. Basically I would like to have each page different with text and image alternately on different page. Page 1 will have all text, Page 2 will have just images, Page 3 will have all text and goes on. This is original code: // Set the label and background color when the view has finished loading. - (void)viewDidLoad { pageNumberLabel.text = [NSString stringWithFormat:@"Page %d", pageNumber + 1]; self.view.backgroundColor = [MyViewController pageControlColorWithIndex:pageNumber]; } As you can see, this code shows only Page 1, Page 2 etc as you scroll right. I tried to put in this new code but that didn't make any difference. There's no error. I know this is pretty simple code. I don't why it doesn't work. I declare pageText as UILabel. // Set the label and background color when the view has finished loading. - (void)viewDidLoad { pageNumberLabel.text = [NSString stringWithFormat:@"Page %d", pageNumber + 1]; self.view.backgroundColor = [MyViewController pageControlColorWithIndex:pageNumber]; if (pageNumber == 1) { pageText.text = @"Text in page 1"; } if (pageNumber == 2) { pageText.text = @"Image in page 2"; } if (pageNumber == 3) { pageText.text = @"Text in page 3"; } } I don't know why it doesn't work. Also if you have better way to do it, let me know. Thanks.

    Read the article

  • MPMoviePlayerController problem at start

    - by Infinity
    Hello guys! I have a problem with MPMoviePlayerController, because when I start it in fullscreen it exists, but the song is still playing. I added the MPMoviePlayerDidExitFullscreenNotification notification and it says that when the video starts playin it exists the full screen. Here's my code: _multimediaPlayer = [[MPMoviePlayerController alloc] init]; _multimediaPlayer.controlStyle = MPMovieControlStyleDefault; _multimediaPlayer.initialPlaybackTime = 0; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoPlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoPlayerDidExitFullscreen:) name:MPMoviePlayerDidExitFullscreenNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoPlayerPlaybackStateChanged:) name:MPMoviePlayerPlaybackStateDidChangeNotification object:nil]; NSString *path = [NSString stringWithFormat:@"%@/mag_%d/%@", [FMUtils documentsFolderPathWithFile:nil], _magID, _pageObject.fileName]; if ([FMUtils fileExistsAtPath:path]) { _multimediaPlayer.contentURL = [NSURL fileURLWithPath:path]; } else { _multimediaPlayer.contentURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", self.dataURL, _pageObject.fileName]]; } CGSize objectViewSize = self.frame.size; _multimediaPlayer.view.frame = CGRectMake(0, 0, objectViewSize.width, objectViewSize.height); [self addSubview:_multimediaPlayer.view]; if (_pageObject.blink) { [_multimediaPlayer setFullscreen:YES animated:YES]; } [_multimediaPlayer play]; Most of the time it happens when the video is not downloaded and it needs to stream it. Do you have any idea why is this happen?

    Read the article

  • retrieve my wall post in my native i phone application

    - by hardik
    hello all i want to retrieve my all the wall post that i have posted until now i am using this fql query from my native iphone application in order to fetch it but i think i am maiking some mistake please guide me how could i do that the following is my fql query to get wall post - (void)session:(FBSession*)session didLogin:(FBUID)uid { NSString *fql = [NSString stringWithFormat:@"SELECT comments, likes FROM stream WHERE post_id=100000182297319"]; NSLog(@"session key is %@",_session.sessionKey); NSLog(@"from global key is %@",[twitfacedemoAppDelegate getfacebookkey]); NSDictionary* params = [NSDictionary dictionaryWithObject:fql forKey:@"query"]; [[FBRequest requestWithDelegate:self] call:@"facebook.fql.query" params:params]; this is my other delgate method to get the wall post but this code is not working - (void)request:(FBRequest*)request didLoad:(id)result { @try { NSLog(@"result is %@",result); if(result==nil) { UIAlertView *a=[[UIAlertView alloc]initWithTitle:@"Can't login" message:@"You cant login here." delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil]; [a show]; [a release]; } else { NSArray* users = result; NSDictionary* user = [users objectAtIndex:0]; NSString* name = [[NSString alloc]initWithString:[user objectForKey:@"name"]]; NSLog(@"name is %@",name); _label.text = [NSString stringWithFormat:@"Logged in as %@", name]; NSString *globalfacebookname; globalfacebookname=[[NSString alloc]initWithString:name]; NSLog(@"value is %@",globalfacebookname); NSString *fid=[user objectForKey:@"uid"]; NSLog(@"FACEBOOK ID WITH STRING DATATYP %@",fid); [twitfacedemoAppDelegate fetchfacebookid:fid]; } } @catch (NSException * e) { NSLog(@"Problem in dialog didFailWithError:%@",e); } } please guide me how could i retrieve my all the post from facebook to my native iphone application through fql query thanks in advance

    Read the article

  • Modifying NSMutableDictionary from a single index format into nested (array within array)

    - by Michael Robinson
    I need to take the member ID off the top of this and create an array inside that contains the rest of the JSON return. Here is my JSON return. [{"F_Name_VC":"Frank", "L_Name_VC":"Johnson", "userid":"18", "age":"23", },] After it is json-deserialized it looks like this: I need convert it to be transformed into this, with children sub-array: Someone else posted a similar question but without the fact that it was coming from a JSON deserialization. There were two answers but no conclusion to the question. (Answer 1): NSDictionary *item1 = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@" member",[NSNumber numberWithInt:3],nil] forKeys:[NSArray arrayWithObjects:@"Title",@"View",nil]]; Answer (2): NSMutableArray *Rows = [NSMutableArray arrayWithCapacity: 1]; for (int i = 0; i < 4; ++i) { NSMutableArray *theChildren = [NSMutableArray arrayWithCapacity: 1]; [theChildren addObject: [NSString stringWithFormat: @"tester %d", i]]; NSString *aTitle = [NSString stringWithFormat: @"Item %d", i]; NSDictionary *anItem = [NSDictionary dictionaryWithObjectsAndKeys: aTitle, @"Title", theChildren, @"Children"]; [Rows addObject: anItem]; } NSDictionary *Root = [NSDictionary withObject: Rows andKey: @"Rows"]; Here is my JSON return and save code: NSData *jsonData = [jsonreturn dataUsingEncoding:NSUTF32BigEndianStringEncoding]; NSError *error = nil; NSDictionary * dict = [[CJSONDeserializer deserializer] deserializeAsDictionary:jsonData error:&error]; if (dict) { rowsArray = [dict objectForKey:@"member"]; [rowsArray retain]; } Thanks in advance. Every tutorial on JSON only shows a simple array being returned, never with children..It's driving me crazy trying to figure this out.

    Read the article

  • iPhone Twitter Integration: Validating login.

    - by Mr. McPepperNuts
    The following code posts to twitter: NSString *compoundLoginString = [NSString stringWithFormat:@"http://%@:%@@twitter.com/statuses/update.xml",extractedUsername, extractedPassword]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL: [NSURL URLWithString:compoundLoginString] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20.0]; // The text to post NSString *msg = tweetText; [request setHTTPMethod:@"POST"]; [request setHTTPBody:[[NSString stringWithFormat:@"status=%@", msg] dataUsingEncoding:NSASCIIStringEncoding]]; NSURLResponse *response; NSError *error; if ([NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error] != nil){ [self postSuccessfulAlert]; }else{ [self postNotSuccessfulAlert]; } I am curious as to how I could check if the username and password is correct before proceeding to the above piece of code. I found the following code in a tutorial, but am unsure how I would implement or call this function. - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { if ([challenge previousFailureCount] == 0) { NSURLCredential *newCredential; newCredential=[NSURLCredential credentialWithUser:[self username] password:[self password] persistence:NSURLCredentialPersistenceNone]; [[challenge sender] useCredential:newCredential forAuthenticationChallenge:challenge]; } else { [[challenge sender] cancelAuthenticationChallenge:challenge]; // inform the user that the user name and password // in the preferences are incorrect NSLog(@"Invalid Username or Password"); } } Any ideas? Please note, I have taken snippets of code from both of the following tutorials. http://iphonedevelopertips.com/networking/post-to-a-twitter-account-from-the-iphone.html and http://icodeblog.com/2009/07/09/integrating-twitter-into-your-applications/

    Read the article

  • Why MKMapView region is different than requested?

    - by Kamil
    Greetings! I'm saving map region into user defaults when my iPhone app is closing like this: MKCoordinateRegion region = mapView.region; [[NSUserDefaults standardUserDefaults] setDouble:region.center.latitude forKey:@"map.location.center.latitude"]; [[NSUserDefaults standardUserDefaults] setDouble:region.center.longitude forKey:@"map.location.center.longitude"]; [[NSUserDefaults standardUserDefaults] setDouble:region.span.latitudeDelta forKey:@"map.location.span.latitude"]; [[NSUserDefaults standardUserDefaults] setDouble:region.span.longitudeDelta forKey:@"map.location.span.longitude"]; When app launches again, i read those values back the same way, so that the user can see exactly the same map view as it was last time: MKCoordinateRegion region; region.center.latitude = [[NSUserDefaults standardUserDefaults] doubleForKey:@"map.location.center.latitude"]; region.center.longitude = [[NSUserDefaults standardUserDefaults] doubleForKey:@"map.location.center.longitude"]; region.span.latitudeDelta = [[NSUserDefaults standardUserDefaults] doubleForKey:@"map.location.span.latitude"]; region.span.longitudeDelta = [[NSUserDefaults standardUserDefaults] doubleForKey:@"map.location.span.longitude"]; NSLog([NSString stringWithFormat:@"Region read : %f %f %f %f", region.center.latitude, region.center.longitude, region.span.latitudeDelta, region.span.longitudeDelta]); [mapView setRegion:region]; NSLog([NSString stringWithFormat:@"Region on map: %f %f %f %f", mapView.region.center.latitude, mapView.region.center.longitude, mapView.region.span.latitudeDelta, mapView.region.span.longitudeDelta]); The region I read from user defaults is (not surprisingly) exactly the same as when it was saved. Notice that what is saved comes directly from the map, so it's not transformed in any way. I set it back on map with setRegion: method, but then it is different! Example results: Region read : 50.241110 8.891555 0.035683 0.042915 Region on map: 50.241057 8.891544 0.050499 0.054932 Does anybody know why this happens?

    Read the article

  • How to update the user profile through tokenid when a particular user logs in using his username and password

    - by Rani
    i have an application in which when the user enters his username and password in the login form , his username and password are submitted to the server database for validation and if he is a valid user a tokenid is generated for him through JSON response and he is allowed to log in.this is the JSON response that i get in the console when a valid user log in through the log in form : {"TokenID":"kaenn43otO","isError":false,"ErrorMessage":"","Result":[{"UserId":"164","FirstName":"Indu","LastName":"nair","Email":"[email protected]","ProfileImage":null,"ThumbnailImage":null,"DeviceInfoId":"22"}],"ErrorCode":900} 2011-06-24 11:56:57.639 Journey[5526:207] this is token id:kaenn43otO so when the same user wants to update his profile by clicking on the update tab using the tokenid So that if he want he can his firstname,lastname,password,email.etc.i i have done the following code to update the user profile using tokenid but it does not work.i get tokenid when the user log in and this tokenid i have to pass to other class: this is my code to update user profile: -(void)sendRequest { //this is the class in which i get the tokenid and i am passing it to this class apicontroller *apitest = [[apicontroller alloc]init]; NSString *tokentest = apitest.tokenapi; NSString *post = [NSString stringWithFormat:@"Token=%@&firstname=%@&lastname=%@&Username=%@&Password=%@&Email=%@",tokentest,txtfirstName.text,txtlast.text,txtUserName.text,txtPassword.text,txtEmail.text]; NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]]; NSLog(@"%@",postLength); NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:[NSURL URLWithString:@"http://192.168.0.1:96/JourneyMapperAPI?RequestType=Register&Command=SET"]]; [request setHTTPMethod:@"POST"]; [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; [request setHTTPBody:postData]; NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; if (theConnection) { webData = [[NSMutableData data] retain]; NSLog(@"%@",webData); [theConnection start]; } else { } } -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { [webData setLength: 0]; } -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [webData appendData:data]; } -(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { [connection release]; [webData release]; } -(void)connectionDidFinishLoading:(NSURLConnection *)connection { NSString *loginStatus = [[NSString alloc] initWithBytes: [webData mutableBytes] length:[webData length] encoding:NSUTF8StringEncoding]; NSLog(@"%@",loginStatus); [loginStatus release]; [connection release]; [webData release]; } -(IBAction)click:(id)sender { [self sendRequest]; } this is my apicontroller.m file in which i am creating login form so that user login and in this page tokenid is generated -(void)sendRequest { UIDevice *device = [UIDevice currentDevice]; NSString *udid = [device uniqueIdentifier]; //NSString *sysname = [device systemName]; NSString *sysver = [device systemVersion]; NSString *model = [device model]; NSLog(@"idis:%@",[device uniqueIdentifier]); NSLog(@"system nameis :%@",[device systemName]); NSLog(@"System version is:%@",[device systemVersion]); NSLog(@"System model is:%@",[device model]); NSLog(@"device orientation is:%d",[device orientation]); NSString *post = [NSString stringWithFormat:@"Loginkey=%@&Password=%@&DeviceCode=%@&Firmware=%@&IMEI=%@",txtUserName.text,txtPassword.text,model,sysver,udid]; NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]]; NSLog(@"%@",postLength); NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:[NSURL URLWithString:@"http://192.168.0.1:96/JourneyMapperAPI?RequestType=Login"]]; [request setHTTPMethod:@"POST"]; [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; [request setHTTPBody:postData]; NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; if (theConnection) { webData = [[NSMutableData data] retain]; NSLog(@"%@",webData); } else { } } //to select username and password from database. -(void)check { //app.journeyList = [[NSMutableArray alloc]init]; [self createEditableCopyOfDatabaseIfNeeded]; NSString *filePath = [self getWritableDBPath]; sqlite3 *database; if(sqlite3_open([filePath UTF8String], &database) == SQLITE_OK) { const char *sqlStatement = "SELECT Username,Password FROM UserInformation where Username=? and Password=?"; sqlite3_stmt *compiledStatement; if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) { sqlite3_bind_text(compiledStatement, 1, [txtUserName.text UTF8String], -1, SQLITE_TRANSIENT); sqlite3_bind_text(compiledStatement, 2, [txtPassword.text UTF8String], -1, SQLITE_TRANSIENT); //NSString *loginname= [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)]; // NSString *loginPassword = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 2)]; } if(sqlite3_step(compiledStatement) != SQLITE_ROW ) { NSLog( @"Save Error: %s", sqlite3_errmsg(database) ); UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"UIAlertView" message:@"User is not valid" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; alert = nil; } else { isUserValid = YES; if (isUserValid) { UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"UIAlertView" message:@"Valid User" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; } } sqlite3_finalize(compiledStatement); } sqlite3_close(database); } -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { [webData setLength: 0]; } -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [webData appendData:data]; } -(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { [connection release]; [webData release]; } -(void)connectionDidFinishLoading:(NSURLConnection *)connection { NSString *loginStatus = [[NSString alloc] initWithBytes: [webData mutableBytes] length:[webData length] encoding:NSUTF8StringEncoding]; NSLog(@"%@",loginStatus); //this is to perfrom insert opertion on the userinformation table NSString *json_string = [[NSString alloc] initWithData:webData encoding:NSUTF8StringEncoding]; NSDictionary *result = [json_string JSONValue]; //here i am storing the tokenid tokenapi = [result objectForKey:@"TokenID"]; NSLog(@"this is token id:%@",tokenapi); // BOOL errortest = [[result objectForKey:@"isError"] boolValue]; if(errortest == FALSE) { values = [result objectForKey:@"Result"]; NSLog(@"Valid User"); } else { NSLog(@"Invalid User"); } NSMutableArray *results = [[NSMutableArray alloc] init]; for (int index = 0; index<[values count]; index++) { NSMutableDictionary * value = [values objectAtIndex:index]; Result * result = [[Result alloc] init]; //through this i get the userid result.UserID = [value objectForKey:@"UserId"]; result.FirstName = [value objectForKey:@"FirstName"]; result.Username =[value objectForKey:@"Username"]; result.Email =[value objectForKey:@"Email"]; result.ProfileImage =[value objectForKey:@"ProfileImage"]; result.ThumbnailImage =[value objectForKey:@"ThumbnailImage"]; result.DeviceInfoId =[value objectForKey:@"DeviceInfoId"]; NSLog(@"%@",result.UserID); [results addObject:result]; [result release]; } for (int index = 0; index<[results count]; index++) { Result * result = [results objectAtIndex:index]; //save the object variables to database here [self createEditableCopyOfDatabaseIfNeeded]; NSString *filePath = [self getWritableDBPath]; sqlite3 *database; if(sqlite3_open([filePath UTF8String], &database) == SQLITE_OK) { const char *sqlStatement = "insert into UserInformation(UserID,DeviceId,Username,Password,FirstName,Email) VALUES (?,?,?,?,?,?)"; sqlite3_stmt *compiledStatement; if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) { //sqlite3_bind_text( compiledStatement, 1, [journeyid UTF8String],-1,SQLITE_TRANSIENT); sqlite3_bind_text( compiledStatement, 1, [result.UserID UTF8String],-1,SQLITE_TRANSIENT); sqlite3_bind_text(compiledStatement, 2, [result.DeviceInfoId UTF8String],-1,SQLITE_TRANSIENT); sqlite3_bind_text(compiledStatement, 3, [txtUserName.text UTF8String],-1,SQLITE_TRANSIENT); sqlite3_bind_text(compiledStatement, 4, [txtPassword.text UTF8String],-1,SQLITE_TRANSIENT); sqlite3_bind_text (compiledStatement, 5, [result.FirstName UTF8String],-1,SQLITE_TRANSIENT); sqlite3_bind_text (compiledStatement, 6, [result.Email UTF8String],-1,SQLITE_TRANSIENT); } if(sqlite3_step(compiledStatement) != SQLITE_DONE ) { NSLog( @"Save Error: %s", sqlite3_errmsg(database) ); } else { UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"UIAlertView" message:@"Record added" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; alert = nil; } sqlite3_finalize(compiledStatement); } sqlite3_close(database); } [loginStatus release]; [connection release]; [webData release]; } -(IBAction)click:(id)sender { [self sendRequest]; //this is to select username and password from database. [self check]; } for a particular user who logs in only his profile must be update by using tokenid and userid.Please help me in solving this problem.Thanks

    Read the article

  • CLLocationManagerDelegate method not calling in iPodTouch

    - by Siddharth
    HI all, I was using a sample code which uses CLLocationManager class to determine the current location of user. when i run this app on iPad i am getting the correct location but when i run the same app on iPod Touch i am getting a blank label i.e nothing is displayed on the label .although wi-fi signal strength is good in both iPod and iPad.The code looks like... - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{ int degrees = newLocation.coordinate.latitude; double decimal = fabs(newLocation.coordinate.latitude - degrees); int minutes = decimal * 60; double seconds = decimal * 3600 - minutes * 60; NSString *lat = [NSString stringWithFormat:@"%d° %d' %1.4f\"", degrees, minutes, seconds]; latLabel.text = lat; [latLocationArray addObject:lat]; degrees = newLocation.coordinate.longitude; decimal = fabs(newLocation.coordinate.longitude - degrees); minutes = decimal * 60; seconds = decimal * 3600 - minutes * 60; NSString *longt = [NSString stringWithFormat:@"%d° %d' %1.4f\"", degrees, minutes, seconds]; longLabel.text = longt; [longLocationArray addObject:longt]; }

    Read the article

  • commitAnimations is not resizing my UIImageView subview

    - by AaronG
    I have created a UIView as a subview and to that subview I have added a UIImageView as a subview. UIView *viewCreated; UIButton *buttonCreated; UIImageView *imageViewCreated; CGRect myFrame = CGRectMake(0, 0, 1024, 1024); viewCreated = [[UIView alloc] initWithFrame:myFrame]; [viewCreated setTag:intTag]; viewCreated.backgroundColor = [UIColor redColor]; [self.view addSubview:viewCreated]; [self randomize]; UIImage *d1Image = [UIImage imageNamed:[NSString stringWithFormat:@"image%d.png", randomNumber]]; imageViewCreated = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f,0.0f,1024.0f, 1024.0f)]; [imageViewCreated setImage:[UIImage imageNamed:[NSString stringWithFormat:@"image%d.png", randomNumber]]]; [viewCreated addSubview:imageViewCreated]; //[imageViewCreated release]; return [viewCreated autorelease]; But when this code executes only the first subview is animated and resized. The UiimageView moves 200 pixels to the left but does not get resized. NSLog(@"sender tag %i",[sender tag]); UIView *currentView = [self.view viewWithTag:[sender tag]]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:1.5]; currentView.frame = CGRectMake(-200, 0,40, 102); [UIView commitAnimations]; I am pretty sure am I not creating the subviews correctly programmatically, because when I do it in Interface Builder it works as expected. Do I have to do something specific to actually attach the behavior of the second subview to the first subview?

    Read the article

  • Retrieving and displaying AddressBook in Table view.

    - by Prash.......
    hi, I am developing an application in which i have to retrieve all Addressbook (Name & Phone No) records and Display it in table view, this is my Snippet for retrieving records from addressbook. NSArray *tableGroups; ABAddressBookRef m_addressbook = ABAddressBookCreate(); if (!m_addressbook) { NSLog(@"opening address book"); } CFArrayRef allPeople= ABAddressBookCopyArrayOfAllPeople(m_addressbook); CFIndex nPeople = ABAddressBookGetPersonCount(m_addressbook); NSMutableArray *selectableRows = [NSMutableArray array]; for (int i=0;i < nPeople;i++) { ABRecordRef ref = CFArrayGetValueAtIndex(allPeople,i); ABMutableMultiValueRef phoneMulti = ABRecordCopyValue(ref, kABPersonPhoneProperty); CFStringRef phoneNumber= ABMultiValueCopyValueAtIndex(phoneMulti, i); NSString *contactFirstLast = [NSString stringWithFormat:@"%@,%@", ABRecordCopyValue(ref, kABPersonFirstNameProperty),phoneNumber]; printf("%s\n", [contactFirstLast UTF8String]); [selectableRows addObject:[NSString stringWithFormat:contactFirstLast, i]]; CFRelease(phoneNumber); CFRelease(ref); CFRelease(contactFirstLast); CFRelease(phoneMulti); } tableGroups = [[NSArray alloc] initWithObjects:selectableRows, nil]; I am getting exception as "CFRetain" and apps get crash. Please suggest me proper solution for that..

    Read the article

  • unable to get data from iphone application

    - by user317192
    Hi, I have made a php web services that takes the username and password from iPhone application and saves the data in the users table. I call that web service from my button touchup event like this: NSLog(userName.text); NSLog(password.text); NSString * dataTOB=[userName.text stringByAppendingString:password.text]; NSLog(dataTOB); NSData * postData=[dataTOB dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES]; NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]]; NSLog(postLength); NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://localhost:8888/write.php"]]; [request setURL:url]; [request setHTTPMethod:@"POST"]; [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; [request setHTTPBody:postData]; NSURLResponse *response; NSError *error; [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; if(error==nil) NSLog(@"Error is nil"); else NSLog(@"Error is not nil"); NSLog(@"success!"); I am getting nothing from Iphone side into the web service and I am unable to understand why this is happening. Although i debugged and found that everything is fine at the iphone application level but the call to the web service doesn't works as expected...... Please suggest..... Thanks Ashish

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >