nsurlsession

App Transport Security breaks Web View

跟風遠走 提交于 2019-12-12 11:35:38
问题 My app which works great under iOS8 no longer runs under iOS9. The problem is that despite having the following in my .plist file: <key>NSAppTransportSecurity</key> <dict> <!--Include to allow all connections (DANGER)--> <key>NSAllowsArbitraryLoads</key> <true/> </dict> The following code: NSURL *targetURL = [NSURL URLWithString:_caseStudyListTitleURL]; NSURLRequest *request = [NSURLRequest requestWithURL:targetURL]; [_myWebView loadRequest:request]; results in the error: NSURLSession

Multiple NSHTTPCookieStorage in the same app

爷,独闯天下 提交于 2019-12-12 09:57:45
问题 I am writing a multi-user app using NSURLSession and I can't figure out how to have a separate cookie storage when working with multiple NSURLSession instances. I tried setting NSURLSessionConfiguration 's HTTPCookieStorage property with a NSHTTPCookieStorage that I alloc/init'ed myself but it doesn't work (cookies aren't stored, even if I call setCookie: myself) I also tried using [NSURLSessionConfiguration ephemeralSessionConfiguration] but then again, my cookies aren't stored between

NSURLSession With Basic Authentication Challenge

柔情痞子 提交于 2019-12-12 09:27:39
问题 I searched all the solution avaliable in stackoverflow. Still confused with this. Please point me if i am doing any mistake. I am getting 401 error. NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://qa.api.xxxxxx.com/v0/jobs/93033"]]; NSString *authStr = @"xxxxxxxx:xxxxxxxxxxx"; NSData *authData = [authStr dataUsingEncoding:NSUTF8StringEncoding]; NSString *authValue = [NSString stringWithFormat:@"Basic %@",[authData base64EncodedStringWithOptions

How to Design the Overlay Menu Above the Home Page?

[亡魂溺海] 提交于 2019-12-12 06:38:43
问题 How to Design the Overlay Instructions Above The View? I HAD 6 buttons....For Each Button I have To show Overlay For That, Before i click on that Button Suppose... 1) Click button is there...above the Click Button we need to show overlay for click on that button Like That... ** [I Need Like This Overlay menu over the all Buttons][1] [1]: http://i.stack.imgur.com/dIjRF.jpg ** 回答1: Use NSURLSession instead. NSURLConnection is deprecated. NSString *stringURL = [NSString stringWithFormat:@"%@

Send data and parameter to server

风格不统一 提交于 2019-12-12 06:36:17
问题 I have this code here that send a data to my server, this code works very well: NSString *imagepath = [[self applicationDocumentsDirectory].path stringByAppendingPathComponent:@"ProgrammingWithObjectiveC.pdf"]; NSURL *outputFileURL = [NSURL fileURLWithPath:imagepath]; NSURL *icyURL = [NSURL URLWithString:uploadURLString]; NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:icyURL]; [request setHTTPMethod:@"POST"]; NSURLSessionConfiguration *sessionConfig =

Error showing response in UITextview

旧巷老猫 提交于 2019-12-12 05:15:45
问题 With reference this question answer i am trying to show output string in textview but its kill it. please check NSLog(@"viewcontroller response =%@",responseString); txt_output.text=[NSString stringWithFormat:@"%@",strResponse]; txt_output is in my ViewcontrollerB, and i am returning from ViewcontrollerA NSString *returnstring=[NSString stringWithFormat:@"request=%@ responstring=%@ error=%@",request,responseString,error]; completionHandler(responseString); Resonse print on log , but after it

NSURLSessionUploadTask is not calling delegate method with NSURLSessionConfiguration backgroundSessionConfiguration

*爱你&永不变心* 提交于 2019-12-12 04:40:01
问题 I am trying upload image using backgroundSessionConfiguration and NSURLSessionUploadTask to keep live upload process in application background mode. But when i use backgroundSessionConfiguration , NSURLSessionUploadTask is not calling delegate method while using defaultSessionConfiguration it call delegate method. Here is the code. //Create a file to upload UIImage *image = [UIImage imageNamed:@"1.jpg"]; NSData *imageData = UIImagePNGRepresentation(image); NSFileManager *fileManager =

How can I get the Data from NSURLSession.sharedSession().dataTaskWithRequest

谁说胖子不能爱 提交于 2019-12-12 04:07:45
问题 class PostFOrData { let url = NSURL( string: "http://210.61.209.194:8088/SmarttvWebServiceTopmsoApi/GetReadlist") var picUrl = NSURL(string : "http://210.61.209.194:8088/SmarttvMedia/img/epi00001.png") var responseString : NSString = "" func forData() -> NSString { let request = NSMutableURLRequest( URL: url!) request.HTTPMethod = "POST" var s : NSString = "" let postString : String = "uid=59" request.HTTPBody = postString.dataUsingEncoding(NSUTF8StringEncoding) let task = NSURLSession

I am calling a url of the image from the webservice. The image is not loaded to uitableview

别说谁变了你拦得住时间么 提交于 2019-12-12 03:32:57
问题 During the debugging of the code I tested the URL, that url works in the browser and the image is displayed in the browser. But the below code is not loading the image to the image wrapper. let row = indexPath.row cell.NewsHeading.font = UIFont.preferredFontForTextStyle(UIFontTextStyleHeadline) cell.NewsHeading.text = SLAFHeading[row] if let url = NSURL(string: SLAFImages[indexPath.row]) { let task = NSURLSession.sharedSession().dataTaskWithURL(url) { (data, response, error) -> Void in if

Memory leak around NSURLSession

纵然是瞬间 提交于 2019-12-12 03:24:37
问题 I am noticing a memory leak around the NSURLSession in my code. Below is the code that uses NSURLSession in my app: -(void)createWithUserId:(NSString*)userId andAccountNumber:(NSString*)accountNumber { NSURL *url = [NSURL URLWithString:[WebServiceUtility getCreateBatchURLWithBaseURL:self.baseURL]]; NSURLSession *session = [NSURLSession sessionWithConfiguration:[WebServiceUtility getSessionConfigurationWithRequestHeader:(NSDictionary*)self.requestHeader andTimeout:self.requestTimeout]];