nsurl

NSData dataWithContentsOfURL

偶尔善良 提交于 2019-12-08 22:29:16
问题 I have this method for button click (download). The problem is that it is terminating due to an exception: [Session started at 2011-03-14 13:06:45 +0530.] 2011-03-14 13:06:45.710 XML[7079:20b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFString isFileURL]: unrecognized selector sent to instance 0x62b8' -(IBAction) download { UIImage *image = [UIImage imageWithData: [NSData dataWithContentsOfURL:@"http://ws.cdyne.com/WeatherWS/Images

App Transport Security on Safari Extension

泪湿孤枕 提交于 2019-12-08 18:47:57
问题 My App extension need to open URL from many websites. I do as following: for (NSExtensionItem *item in self.extensionContext.inputItems) { for (NSItemProvider *itemProvider in item.attachments) { if ([itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeURL]) { [itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeURL options:nil completionHandler:^(NSURL *url, NSError *error) { NSLog(@"URL: %@",url); I can get the URL, but at this point I got this error: App Transport

How to encode hebrew string (NSString) into a Unicode format in order to send as a URL in Objective-C

穿精又带淫゛_ 提交于 2019-12-08 11:26:14
问题 The title pretty much sums it up. I have a hebrew-containing String used in a NSUrl: NSString * urlS = @"http://irrelevanttoyourinterests/some.aspx?foo=bar&this=that&Text=תל אביב" I would like to convert in into: Text=%u05EA%u05DC%20%u05D0%u05d1%u05d9%u05d1 and then send it as a GET request. I have tried many encoding methods unsuccessfully, and eventually I tried statically inserting the encoded string into the URL, quoted above. NSURL *url1 = [NSURL URLWithString:urlS]; Then I use

Recieving SOAP error when requesting a WCF Web Service in Objective C (iOS App)

强颜欢笑 提交于 2019-12-08 10:21:28
问题 I am trying to call a web service from an iOS app. I have developed that service in WCF. The web service is hosted on IIS configured with BasicHTTPBinding. I have developed a simple iOS app that calls that web service hosted on a remote PC. The iOS app is working fine but the SOAP service doesn't seem to understand the request I am sending from the iOS app. Here are all the details, the error I get is at the end. The WSDL of web service is: <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap

How to extract scheme and host of a URL once?

China☆狼群 提交于 2019-12-08 09:23:15
问题 Imagine this is my URL NSURL *theURL=[NSURL URLWithString:@"http://stackoverflow.com/questions/ask"]; How can i extract only: http://stackoverflow.com ? 回答1: How about [NSString stringWithFormat:@"%@://%@", [theURL scheme], [theUrl host]] 回答2: Have you tried [theURL host]? 来源: https://stackoverflow.com/questions/8890475/how-to-extract-scheme-and-host-of-a-url-once

Error while trying to access Google translate with NSURL

假装没事ソ 提交于 2019-12-08 08:56:12
问题 If I try this code: NSError *err = nil; NSString *resp = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"https://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=abdicate&langpair=en|es"] encoding:NSASCIIStringEncoding error:&err]; Err contains the following message: Error Domain=NSCocoaErrorDomain Code=258 UserInfo=0x1001166d0 "The file name is invalid." Anybody knows what this means? If I try the url on a browser, it works fine. 回答1: (Using NSData ) you can just replace

_OBJC_CLASS_$_NSURL error with iPhone OS4.0

余生颓废 提交于 2019-12-08 08:39:20
问题 I have a OS3.1 project which now needs to be upgraded via SDK 4.0 But when I try to compile to a device runing 3.1 Im getting this linker error. dyld: Symbol not found: _OBJC_CLASS_$_NSURL Referenced from: /var/mobile/Applications/E93D0DD1-18EB-4D2E-B99E-23B74EBE42CC/RacingUK.app/RacingUK Expected in: /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation in /var/mobile/Applications/E93D0DD1-18EB-4D2E-B99E-23B74EBE42CC/RacingUK.app/RacingUK Base SDK is 4.0 and DeploymentTarget is

how to post array of images in multipart http post request

烂漫一生 提交于 2019-12-08 02:21:08
问题 I want to upload array of images, how should I append array to NSMutableData . here is my code func createBodyWithParametersMulti(parameters: [String: String]?, filePathKey: String?, imageDataKey: [NSData?], boundary: String) -> NSData { let body = NSMutableData(); if parameters != nil { for (key, value) in parameters! { body.appendString("--\(boundary)\r\n") body.appendString("Content-Disposition: form-data; name=\"\(key)\"\r\n\r\n") body.appendString("\(value)\r\n") } } if(imageDataKey

Copy image from assets-library to an app folder

点点圈 提交于 2019-12-08 00:31:18
问题 I have an UIImagePickerController and I would like to save a selected image to my app. I can do that easy by getting the current UIImage and save it (by creating a file) but I would prefer to directly copy the file from Library to my folder. So now I have an URL of the selected image : UIImagePickerControllerReferenceURL which return a specific pattern "assets-library". I tried to copy an image from this kind of URL to a path but without success. Is there a way to success on what I would like

NSURLConnection and NSMutableURLRequest Authentication

做~自己de王妃 提交于 2019-12-07 18:40:29
问题 I have an iOS application which will submit a username and password to a website and to retrieve the HTML code of the webpage which loads after pressing 'Sign in': https://grades.bsd405.org/Pinnacle/Gradebook/Logon.aspx?. The form data fields are the following: __LASTFOCUS, __EVENTTARGET, __EVENTARGUMENT, __VIEWSTATE, __EVENTVALIDATION, ctl00$ContentPlaceHolder$Username, ctl00$ContentPlaceHolder$Password, ctl00$ContentPlaceHolder$lstDomains, ctl00$ContentPlaceHolder$LogonButton, PageUniqueId