nsurl

Double hashtag in openURL() crashes the app

痞子三分冷 提交于 2019-12-11 04:46:29
问题 I need to make a phone call from the app, so far it's working. The number consists of two numbers: phone number, and pass code followed by hashtag. But some users need to put double hashtag in the end of the number, and that crashes the app when it's calling that URL at once: UIApplication.sharedApplication().openURL(NSURL (string: "tel//:1111111,,222##")) With single hashtag it's working, and it is possible to press hashtag on the keyboard after device has dialed already. I tried to append

save html page with the images,javascript and css in one folder in iphone application

房东的猫 提交于 2019-12-11 01:52:28
问题 I want to save webpage in document directory with the images,css and javascripts etc.. I have done below code : But it only generates the html file.. NSURL *url = [NSURL URLWithString:@"http://www.apple.com"]; NSData *urlData = [NSData dataWithContentsOfURL:url]; [urlData writeToFile:filePath atomically:YES]; Any idea or suggestion is most welcome. Thanks 回答1: The ASIHTTPRequest project has a class called ASIWebPageRequest which is designed to do exactly what you want. If you're okay with

Cocoa/Objective-C get a HFS path (path:to:desktop) from a posix path (path/to/desktop)

本秂侑毒 提交于 2019-12-10 21:14:02
问题 I am on OSX, Objective-C. I have a path/NSURL like /Users/xxx/Desktop/image2.png But i pass it to a third party application that excpects finder pathes like Harddisk:Users:Desktop:image2.png Is there any method (i can't find) to convert pathes like that or get them out of an NSURL (if possible without string modifying)? In AppleScript it is return POSIX file "/Users/xxx/Desktop/image2.png" --> Harddisk:Users:xxx:Desktop:image2.png EDIT : This is pretty much the same: Cocoa path string

How to determine a volume supports resolving bookmarks to renamed or moved files?

妖精的绣舞 提交于 2019-12-10 19:34:27
问题 - bookmarkDataWithOptions:includingResourceValuesForKeys:relativeToURL:error: Documentation states: This method returns bookmark data that can later be resolved into a URL object for a file even if the user moves or renames it (if the volume format on which the file resides supports doing so). My question is, how can I query if a volume supports this feature? From trial and error it seems only (internal?) hard drives support it, but I am looking for some kind of sure test like a

How to open the ios Native dialer app from my App

牧云@^-^@ 提交于 2019-12-10 17:18:37
问题 I want to open the native dialer app and allow the user to enter the phone number there. The reason why i want this is because in my app the user needs to use USSD codes in order to make calls, but using the code bellow nothing happens (nothing is started) NSString *phoneNumber = [@"tel://" stringByAppendingString:number]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]]; I read here (StackOverflow) that making calls from your app that contain * and # are

Is it right to say that paths are represented as URI while web-addresses are represented as URL?

北城余情 提交于 2019-12-10 12:17:58
问题 I am confused by Apple's documentation about the NSURL class. In NSURL, they say the following: NSURL understands URLs in style of RFC 1808, 1738 und 2732 NSURL understands URIs in style of RFC 2396 Also they say that the RFC 2396 URI are paths. Now what's the difference here? Isn't a path also an URL? I mean, it's an location or not? 回答1: Both URLs and URIs identify resources (which are anything). However, a URL is the term used for an identifier that specifies how to locate the resource.

NSURLSession delegate methods not called

不问归期 提交于 2019-12-10 09:28:18
问题 I have created a very simple app to download a text file from my web server. I have this working perfectly with NSURLConnection, but am trying to migrate over to NSURLSession instead. The issue I am having is that none of the delegate methods are being called. My server is password protected so I need to use the basic http authentication to access the file, but when the didReceiveChallenge method is never called. The line of code [getFileTask resume] seems to have no effect on anything. My

Swift get NSData of a video from photos library

拜拜、爱过 提交于 2019-12-09 13:40:03
问题 Im using UIImagePickerController to select a video from my library. I need to extract the NSData of my video file. Im using the following operation to select a video from my library but my data appears to be nil however my AVPlayer plays the video from the resulting NSURL so I know problem is not with the NSURL. How can I extract the NSData of my selected video file? func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) { let

NSURL baseURL returns nil. Any other way to get the actual base URL

北战南征 提交于 2019-12-09 05:19:44
问题 I think I don't understand the concept of "baseURL". This: NSLog(@"BASE URL: %@ %@", [NSURL URLWithString:@"http://www.google.es"], [[NSURL URLWithString:@"http://www.google.es"] baseURL]); Prints this: BASE URL: http://www.google.es (null) And of course, in the Apple docs I read this: Return Value The base URL of the receiver. If the receiver is an absolute URL, returns nil. I'd like to get from this example URL: https://www.google.es/search?q=uiviewcontroller&aq=f&oq=uiviewcontroller

NSURLErrorDomain error -1021

风格不统一 提交于 2019-12-09 01:53:56
问题 I'm developing an app were I integrated dropbox. Login is done properly also I'm able to create folder in dropBox. But when I try to load file I'm getting error Following error I'm getting error making request to /1/files_put/dropbox/Info.plist - Error Domain=NSURLErrorDomain Code=-1021 "The operation couldn’t be completed. (NSURLErrorDomain error -1021.)" UserInfo=0x6859bc0 {destinationPath=/Info.plist, sourcePath=/Users/bcod/Library/Application Support/iPhone Simulator/5.0/Applications