nsurlconnection

mySQL database to iPhone app

纵然是瞬间 提交于 2019-12-06 12:52:42
问题 I have a MySQL database on a web server and need to read the data from an iPhone app. What is the best way to do this? The data needs to be accessed from the web server and will be updated from time to time. Is the NSURL Class the way to go? thanks for any help. 回答1: I suggest a simple web technology on the server side -- PHP, Ruby on Rails, etc. -- that acts as a basic RESTful-ish web service that sends out JSON. This is straightforward and doesn't require a lot of programming expertise --

NSURLConnection Progress Bar with sendAsynchronousRequest Objective-C

限于喜欢 提交于 2019-12-06 11:03:26
问题 I am downloading a bunch of largish zip files with the following method. It can take a little while and so I'd like to display a progress bar. I've researched how to do with with the delegate methods for NSURLConnection and it seems straightforward, however I want to achieve the same thing with "sendAsynchronousRequest". How can I get the number of bytes downloaded as it downloads as well as the total number of bytes expected so that I can display a progress bar? I understand that I cannot

NSURLConnection connection:didReceiveData: is not called on ios5

别来无恙 提交于 2019-12-06 09:42:49
A weird problem. I wanna load an image from web, so i use NSURLConnection to do it. Everything is ok when i do testing my code on ios4.3. But when i'm launch my app on ios5.0, i found the connection:didreceiveData haven't been called whatever what i did. otherelse functions is called normally, just like connectionDidFinishLoading in ios4.3 and connectionDidFinishDownloading in ios5.0. so u guys, who can help me, thanks advanced! -(void)load { if(isDownloading){ return; } if(conn != nil){ [conn release]; } if(data != nil){ [data release]; data = nil; } [self isDownloading:YES];

Test NSURLConnection failure

此生再无相见时 提交于 2019-12-06 09:35:08
How can you test a failure of NSURLConnection? Also, how do you tell if it failed due to airplane mode or WiFi being turned off? In my tests, while the alert pops up telling the user they need to turn on WiFi, if they ignore it my App just sits there and spins waiting for a response. If your connection's delegate is self, you can something like this: self.myConnection = [[[NSURLConnection alloc] initWithRequest:urlRequest delegate:self] autorelease]; - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { if ([error code] == kCFURLErrorNotConnectedToInternet) { //

HTTP connection with NSURLConnection in iphone

为君一笑 提交于 2019-12-06 09:32:23
Thanks a lot for reply. I am stuck here. Can you please help with this situation? Can CFHTTPStream will resolve this problem? Is there any other way to work with this problem ? Thanks. Hi, I am connecting to an HTTP url using NSURLConnection. I am supposed to get response after some time intervals (The response is not getting closed from server). Is it possible to read those responsed whenever they are written just like having an infinite while loop on input stream of http url connection in java. The didReceiveData method is not getting called. Consider it as an http push where response will

Send POSTs to a PHP script on a server

删除回忆录丶 提交于 2019-12-06 09:16:38
问题 I have a PHP script on a server <?php // retrieve POST vars $comment = $_POST['comment']; $email = $_POST['email']; // remove trailing whitespace etc $comment = trim($comment); $email = trim($email); // format date accoring to http://www.w3schools.com/php/func_date_date.asp $date_time = date("Y-m-d-H-i-s"); // i.e. 2010-04-15-09-45-23 // prepare message $to = "(removed my email addy)"; //who to send the mail to $subject = "Feedback from iPhone app"; //what to put in the subject line $message

how download file with NSURLConnection in storyboard

大城市里の小女人 提交于 2019-12-06 09:01:18
问题 I am a noob in NSURLConnection . I have searched Google and found this site but I dont understand about it. My friends please explain the code that I have downloaded from url in Document folder. This is my code : - (void)viewDidLoad { [super viewDidLoad]; NSURL *url =[NSURL URLWithString:@"http://cdn.arstechnica.net/wp-content/uploads/2012/09/iphone5-intro.jpg"]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; NSURLConnection *con = [[NSURLConnection alloc]initWithRequest:request

NSURLConnection not responding

独自空忆成欢 提交于 2019-12-06 08:09:53
问题 I'm trying to get some data from an URL, but for some reason, nothing happens when I do the following. Neither didReceiveResponse: , didReceiveData: , didFailWithError: or connectionDidFinishLoading: are reached, except when I add a timeout to my request by doing this: [request setTimeoutInterval:10.0] Here's what I'm doing : -(void)getConfigFromServer{ [self getContentAtURL:kUrlGetUser]; } //Va chercher le contenu à l'URL passée en paramètre - (void)getContentAtURL: (NSURL *)url {

Strange problem with appendData in didReceiveData method of NSURLConnection

人盡茶涼 提交于 2019-12-06 07:21:18
I got this weird problem in implanting simple NSURLConnection... The method didReceiveData get call and I'm happily trying to append the receive data but... nada! There's some data for sure (as the length indicate but appendData do NOT append the data! I start to bang my head on this one and I need some help before it's to late :-) Here some code to look at : My header... @interface ActionViewController : UITableViewController { Site *site; NSURLConnection *siteConnection; NSMutableData *receivedData; UIView *waitView; UIActivityIndicatorView *activityIndicator; int nConnections; BOOL fail; }

didReceiveAuthenticationChallenge getting called only once iPhone

半世苍凉 提交于 2019-12-06 06:43:59
问题 I am connecting to server using NSURLConnection . The server asks for basic authentication for which I am using the delegate methods :- didReceiveAuthenticationChallenge . But this gets called only once. If I change password to some different value, then this delegate methods does not get called and it takes my login as successful? Any kind of help will be appreciated. Thanks. 回答1: Solved! It turns out that NSURLConnection was actually behaving correctly - that is,