nsurlconnection

How to get cookie from Webserver and maintain it in iOS app?

怎甘沉沦 提交于 2019-12-25 03:27:10
问题 I would like to to get fetch JSON from http://mycompany.com/page1...http://mycompany.com/page2... On the the webserver side, it requires initial login http://mycompany.com/login, and after that a cookie is maintained for the user. How do I get this behavior with NSURLConnection without having to ask for login every time? Here is the non-working code using NSURLCredential Storage. Do I need to get the cookie from webservice at loging and then send it along with later requests? I struggled with

NSURLConnection 5 seconds delay

久未见 提交于 2019-12-25 03:08:42
问题 i have the following code to make requests to my api: -(void)makeApiCall:(NSString *)function params:(NSDictionary *)params notificationName:(NSString *)notificationName { NSURL *url = [NSURL URLWithString:kBaseUrl]; AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url]; httpClient.parameterEncoding = AFFormURLParameterEncoding; NSMutableURLRequest *request = [httpClient requestWithMethod:@"POST" path:[NSString stringWithFormat:@"%@/%@",kApiBaseUrl,function] parameters:params]

Trying to make GET request in objC using NSURL

旧城冷巷雨未停 提交于 2019-12-25 02:43:39
问题 I'm trying to make this request in an iOS app I've already logged into the website using NSURLConnection , the following code is in the completion handler: NSMutableURLRequest *requestGrades = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"https://mistar.oakland.k12.mi.us/novi/StudentPortal/Home/LoadProfileData/Assignments?_=1395809728907"]]; [requestGrades setHTTPMethod:@"GET"]; [NSURLConnection sendAsynchronousRequest:requestGrades queue:[NSOperationQueue mainQueue]

App crashing when downloading a large file - NSFileHandle seekToEndOfFile

*爱你&永不变心* 提交于 2019-12-25 02:18:20
问题 I have a loop that gets the URLs of a bunch of files (10 small txt files and 1 large image file around 700KB) and runs 'getFile' which creates an NSUrlConnection for each one. When the app gets to [file seekToEndOfFile] just before [file writeData:data] it crashes with: *** Terminating app due to uncaught exception 'NSFileHandleOperationException', reason: '*** -[NSConcreteFileHandle seekToEndOfFile]: No such process' *** First throw call stack: The strange thing is that if I step through the

NSURLConnection doesn't receive data when creating many downloading objects in iOS5

…衆ロ難τιáo~ 提交于 2019-12-24 23:18:20
问题 I have been searching for this problem on the SOF for several days and I still have not found the solution (say the same problem) yet. I'm making and app that downloads 5 images simultaneously in an URL list (each image is on a different server). I have an ImageDownloader class subclasses NSOperation and implements the NSURLConnectionDataDelegate . So that I can add an instance of ImageDownloader to an operationQueue in the ViewController and it will run in a separate thread under the

NSURLConnection Hanging on Second Call

£可爱£侵袭症+ 提交于 2019-12-24 22:36:08
问题 I'm building an iPhone app that aggregates data from several different data sources and displays them together in a single table. For each data source, I've created a class ( WeatherProvider , TwitterProvider ) that handles connecting to the datasource, download the data and storing it in an object. I have another class ConnectionManager , that instantiates and calls each of the two provider classes, and merges the results into a single NSArray which is displayed in the table. When I run the

how to submit a password with special characters from app to a web-server by NSURLConnection

痴心易碎 提交于 2019-12-24 15:42:41
问题 I have to login with my to a web-server.All works fine, but not generated passwords like |%<">{}¥^~ . How I have to encode passwords like this? I create a User with password=|%<">{}¥^~ doset work ( for example a password like "user1234" works fine) NSString *userName = self.usernameOutlet.text; NSString *userPassword = self.passwordOutlet.text; NSString *escapedString = [self.passwordOutlet.text stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]];

iphone sdk: pausing NSURLConnection?

﹥>﹥吖頭↗ 提交于 2019-12-24 15:06:20
问题 In my app I give the user the ability to download files from a server. For that I use NSURLConnection. I would like to give the user the ability to pause and resume the download by tapping a button. I couldn't find any way to do this besides calling the cancel method and then creating a new NSURLConnection. So is there an elegant way to pause NSURLConnection? Thanks 回答1: That's the only method I'm aware of. If your server supports the "Range:" header, you can then create a new connection and

Calls to NSURLConnectionDataDelegate methods to download images only works occasionally

泄露秘密 提交于 2019-12-24 14:23:55
问题 I currently have two UIImageView s in my storyboard, one of which downloads my own Facebook profile picture, and the other a friend's profile picture. However, my issue is that only 60% of the time this works as expected , while the other 40% of the times my own profile picture appears where my friend's picture should show in the bottom, while the top box remains empty. I am unsure whether this is the result of how I call the NSURLConnectionDataDelegate methods as it downloads or completes

How to download epub Format file from URL to Document Directory in Iphone

拈花ヽ惹草 提交于 2019-12-24 13:18:08
问题 I want to save an epub format file from url into App Document Directory.When I hit this url in browser it provides a downloading file where as when I send the request in NSURLConnection it provides me data, upon converting this data in to NSString return NULL.How to save this file with success. My Code snippet is this :- - (void)viewDidLoad { NSMutableString *str = [[NSMutableString alloc] initWithFormat:@"http:// url", tagId];<br/> NSURL *url = [[NSURL alloc] initWithString:str]; NSLog(@"URL