asihttprequest

Can an ASIHTTPRequest be retried?

旧时模样 提交于 2019-12-05 12:46:06
Is there a way to retry an ASIHTTPRequest? I'm using custom authentication in a REST service instead of basic HTTP authentication and I would like to retry a request if the session has expired. Calling startAsynchronous a second time on a request causes an exception. I would like to do something like this: [request setCompletionBlock:^{ if ([request responseStatusCode] == 500) { // try to login again in case token expired [server loginAndRetryRequest:request]; } else { // parse response } }]; loginAndRetryRequest: will do another ASIHTTPRequest to login and when it is complete it will start

Sending AVAudioRecorder to server iOS

旧巷老猫 提交于 2019-12-05 11:32:45
I am trying for the past few days to upload a locally saved sounde record to a server (which handels it with a php file and saves it to the server). the problem is that I can't find a way to do that. While recording the sound (AVAudioRecorder) it saves at a "NSTemporaryDirectory()": NSURL *temporaryRecFile = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"VoiceFile"]]]; Now, everywhere I checked the answer was to use ASIHTTPRequest . but the problem is that it is not supported in ios6. There are some other libraries for it but nothing

Empty body in POST in ASIHTTPRequest

瘦欲@ 提交于 2019-12-05 09:15:58
Basically, I am sending a POST request with an empty data body: ASIHTTPRequest *request [ASIHTTPRequest alloc] init]; [request setURL:[NSURL URLWithString:escapedUrlString]]; [request setRequestMethod:@"POST"]; [request addRequestHeader:@"Content-Type" value:@"application/xml"]; [request startSynchronous]; But i am getting this response each time: Incorrect NSStringEncoding value 0x0000 detected. Assuming NSStringEncodingASCII. Will stop this compatiblity mapping behavior in the near future. I am wondering if it's mandatory to set post values. I don't have much experience with the

Strange Crash issue as:- Dispatch queue: com.apple.root.default-overcommit-priority

左心房为你撑大大i 提交于 2019-12-05 05:54:41
I am developing an application in which a lot of operations are added in ASINetworkQueue.The operations are basically used for fetching the image from server and then in successful completion set the image in table view cell. Everything is happening fine.I have a button a table view cell on which another view controller gets opened. On that another view there is a cross button on which I pop that view controller. Now when the cross button gets clicked sometimes the app gets crashed there, sometimes it gets crashes when comes back to the previous view and scrolling my table view. When I see the

ASIHTTPRequest: incorrect NSStringEncoding value 0x0000 detected

匆匆过客 提交于 2019-12-05 03:06:10
问题 Incorrect NSStringEncoding value 0x0000 detected. Assuming NSStringEncodingASCII. Will stop this compatiblity mapping behavior in the near future. When I was using ASIHTTPRequest, I keep getting this error(50% of the times), what's wrong with it? I assume the URL I passed in is correct, as it does not contain any space or strange character, maybe it is the result string having some unrecognized character? 回答1: Copying my answer from https://stackoverflow.com/q/8251175/918764 The error is not

Asihttprequest localizedDescription always in English

只谈情不闲聊 提交于 2019-12-04 22:37:49
im using Asihttprequest for my HTTP request, and my app will handel 3 language : arabic, french and english but Asihttprequest error localizedDescription return always an english description. is Asihttprequest request use the default ios systeme localisation description? if yes how can i localize error ? thank you. ravi I am not sure of what exactly you asked for, but you can try this. In the ASIHttpRequest.m file Initialize method use NSLocalizedString(@"REQUESTTIMEOUT_KEY", @"The request timed out") instead of @"The request timed out" . Have the "REQUESTTIMEOUT_KEY" = "EngVersion:The request

Display records of next page in json in uitableview on scrolling the tableView when I reach the last record

微笑、不失礼 提交于 2019-12-04 22:01:24
I am trying to make an application that uses SBJSON and ASIHTTPRequest containing 273 pages (50 records in each page)in json. When I scroll the tableView I want to get next 50 records when I reach the last record.Currently I am getting only the first 50 records. How will I get all the records? I am using Xcode 6 objective c. //Here I am taking the json data on view load - (void)viewDidLoad { [super viewDidLoad]; main_array = [[NSMutableArray alloc] init]; NSURL *countryURL = [NSURL URLWithString:@"http://api.worldbank.org/countries/all/indicators/SP.POP.TOTL?format=json"]; ASIHTTPRequest

How to store audio file in sqlite database in iOS

喜夏-厌秋 提交于 2019-12-04 20:56:19
I am developing an iPhone application for an audio player. I want to give some options to the user so they can listen to the song/music by streaming or they can download the audio file and store in sqlite database. I know how to stream the audio files in the app programmatically. But I don’t know how to store the downloaded audio file in sqlite database using BLOB. Additionally, after storing the audio file in the sqlite DB I need to fetch the audio file and play the song. How do I fetch the audio file from sqlite DB? This is my code for downloading the audio file. NSURL *url = [NSURL

Download progress in cell

时间秒杀一切 提交于 2019-12-04 20:45:30
I'm trying to develop a progress view inside UITableViewCell . In my first realization I used AFHTTPRequestOperation and its setDownloadProgressBlock:^ inside my cell. Later my goal became more complicated. I have one UITableView that displays different content (song playlists). The same song might exits in several playlists. When I start to download the song in one playlist and switch to another (which also contains this song) I want to see the download progress like in the first playlist. I have succeeded to make it work. At the beginning of download process I create a progress view in

Instrument (XCode4) report ASIHttpRequest leak memory?

耗尽温柔 提交于 2019-12-04 19:56:11
I get Instrument tools in XCode 4 report memory leaks from ASIHttpRequest... I didn't be able to figure out the problem, turned our I commented out all my code to handle the result and make the function like below, but xcode still report the same memory leak... This method is called everytime when I click a button, and I will see more memory leak happen every time when I hit the button. :( - (void) loadData { // no data set, we need to load ourself NSURL *url = [self getDataUrl]; ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; ////////////////////////////////////////////////////