nsurlrequest

How return data from an HTTP request in Swift/Objective C

岁酱吖の 提交于 2019-12-19 10:21:17
问题 I'm trying to use Coinbase's API to get information about my online bitcoin wallet, and I'm trying to use Swift's NSURLSession object to do so. Perhaps I'm missing something obvious in the Apple docs, but after reading through the information about NSURLSession and NSURLSessionTask I still do not understand how to make an HTTP request and then return the body of the response so that the body can persist throughout the life of my app. As of now I only see the ability to use completion blocks

Mutable NSHTTPURLResponse or NSURLResponse

别说谁变了你拦得住时间么 提交于 2019-12-19 09:56:48
问题 I need to modify response headers in an NSURLResponse. Is this possible? 回答1: I was just talking about this with a friend. My suggestion would be to write a subclass of NSURLResponse. Something along these lines: @interface MyHTTPURLResponse : NSURLResponse { NSDictionary *myDict; } - (void)setAllHeaderFields:(NSDictionary *)dictionary; @end @implementation MyHTTPURLResponse - (NSDictionary *)allHeaderFields { return myDict ?: [super allHeaderFields]; } - (void)setAllHeaderFields:

NSURLRequest hanging SpringBoard

可紊 提交于 2019-12-19 09:22:24
问题 I have a MobileSubstrate addon that hooks springboard (not in the actual objective c code, but with the plist). It contains a UIWebView, which loads a NSURLRequest. This NSURLRequest is here: NSString *urlAddress = @"http://www.google.com"; NSURL *url = [NSURL URLWithString:urlAddress]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; [webView loadRequest:requestObj]; This NSURLRequest hangs springboard. I did LOTS of testing, and I am 100% sure that this NSURLRequest hangs

How to make NSURLRequest to obtain a Twitter request token?

冷暖自知 提交于 2019-12-19 04:50:28
问题 I am trying to obtain a request token from Twitter with this code: NSMutableURLRequest *mURLRequest = [[NSMutableURLRequest alloc]initWithURL:[NSURL URLWithString:@"https://api.twitter.com/oauth/request_token"]]; mURLRequest.HTTPMethod = @"POST /oauth/request_token HTTP/1.1"; [mURLRequest setValue:@"User-Agent" forHTTPHeaderField:@"Coupled HTTP"]; [mURLRequest setValue:@"OAuth oauth_callback=\"http%3A%2F%2Fbytolution.com\"" forHTTPHeaderField:@"Authorization"]; [mURLRequest setValue:@"api

How to use NSURLRequest / NSURLConnection to download an mp3 file to app?

与世无争的帅哥 提交于 2019-12-19 03:06:36
问题 The Situation In my app, I am currently downloading an mp3 file (to docs directory) using [NSData dataWithContentsOfURL:URL] , a method that works fine, but ties down the CPU, dissallowing screen updates of download status. So, I want to download using a different method so that I can update the screen WHILE downloading to alert the user that the download has begun. Question How do I set up my viewController to use NSURLRequest or NSURLConnection to download an mp3 file? (please give source)

Sending multipart POST from iOS and reading parameters in PHP $_POST?

一个人想着一个人 提交于 2019-12-18 11:56:16
问题 I'm trying to send a multi-line post from an iPhone/iPad to a php service, the problem is that for some reason, the POST Content-Type seems to be application/x-www-form-urlenconded, ( I found out this using Wireshark ) This is actually a snippet of the Wireshark POST packet capture: **Content-Type: application/x-www-form-urlencoded\r\n** Content-Length: 324\r\n [Content length: 324] Connection: keep-alive\r\n \r\n [Full request URI: http://my.server.com/mobile/tools/authentication] Line-based

UIWebView won't load links with certificate (https:// prefix)

倾然丶 夕夏残阳落幕 提交于 2019-12-18 11:43:07
问题 I know this has been asked before but I have looked at every answer (there aren't many) and none help me. The issue I am running into is dealing with certificates with my schools e-mail service. The links for the two e-mail services are here: Main school e-mail: https://marauder.millersville.edu/mail/index.pl Computer Science e-mail: https://cs.millersville.edu/cswebmail University student portal (Marauder Mail button on the right doesn't open when clicked in my UIWebView) http://myville

NSMutableURLRequest timeout doesn't trigger if data starts to load but not webViewDidFinishLoad

落花浮王杯 提交于 2019-12-18 09:12:39
问题 I am loading a UIWebview and requesting a URL that can take some time to finish loading. The request starts and begins to receive data. However, it doesn't appear that the request finishes. The webViewDidFinishLoad never triggers nor does the webView didFailLoadWithError: callback. Does a timeout of a NSURLRequest only occur if there is no response receiving data or does it trigger if the request doesn't complete in that interval as well? If it's the former, is there an elegant solution to

iOS: Is it possible to open NSURLRequest directly in Safari?

梦想与她 提交于 2019-12-18 05:06:08
问题 I'm not talking about a UIWebView , I want to open the mobile safari app using an NSURLRequest . Why? In my app, the user has already logged into our web server. I want to give the user the option of launching the webpage without having to reenter their credentials. However, I can't use a GET because that would put their credentials in the URL. So, can I open the safari app (not a UIWebView ) from my app with an NSURLRequest or a POST in some other form? 回答1: I'm going to put my neck on the

iOS: Is it possible to open NSURLRequest directly in Safari?

你说的曾经没有我的故事 提交于 2019-12-18 05:06:04
问题 I'm not talking about a UIWebView , I want to open the mobile safari app using an NSURLRequest . Why? In my app, the user has already logged into our web server. I want to give the user the option of launching the webpage without having to reenter their credentials. However, I can't use a GET because that would put their credentials in the URL. So, can I open the safari app (not a UIWebView ) from my app with an NSURLRequest or a POST in some other form? 回答1: I'm going to put my neck on the