nsurl

How do I remove/decode URL percent encoding?

不问归期 提交于 2021-02-04 14:28:06
问题 I want to take a url and convert it to a more readable format. For example I have the following link: http://en.wikipedia.org/wiki/S%C3%A1ndor_Font I take away the unnecessary parts and am left with "S%C3%A1ndor_Font" as a NSString . Is there any sort of way to convert this into "Sándor Font" (what it actually should be), without having to type out every single combination of special characters and replacing each part of the string? To demonstrate how I want to use this, I wrote the following

where to provide NSURL value?

只谈情不闲聊 提交于 2021-01-27 14:20:38
问题 Every time I run the app it crashes and the console says: Terminating app due to uncaught exception 'MissingDatabaseURL', reason: 'Failed to get FirebaseDatabase instance: Specify DatabaseURL within FIRApp or from your databaseForApp:URL: call. I have the URL I don't know where to place it. I am new to objective C. This is the line that firebase say to use I Just don't know where to place the value of url. + (FIRDatabase *)databaseForApp:(FIRApp *)app URL:(NSString *)url 回答1: It looks like

MacOS sandboxed application: access files without NSOpenPanel

夙愿已清 提交于 2020-05-14 04:02:30
问题 In a sandboxed NSDocument-based application, any compatible document can be accessed using the NSOpenPanel, no matter where the document is saved. Without NSOpenPanel, the application can only access files in the sandbox container. As my application manages two types of subclassed NSdocument (Text as a reader/writer and Image as a reader only), I try to implement a separate "Open Recent" menu for images. I disabled the the ordinary behaviour for them as they are opened by the user, overriding

Unable to create NSUrl from NSString always getting nil

守給你的承諾、 提交于 2020-01-30 02:45:10
问题 NSMutableString *string = [[NSMutableString alloc]initWithString: @"http%3A%2F%2Fsupport24hour.com%2Fworkplace2%2Fbuttler%2Fimage.php%3Fwidth%3D534%26height%3D256%26image%3Duploads%2Fdeals%2FdealImage%2Fdeal_1383005121_IGA+Logo.JPG"]; [string replaceOccurrencesOfString:@"+" withString:@" " options:NSCaseInsensitiveSearch range:NSMakeRange(0, [string length])]; NSURL * url = [NSURL URLWithString:[string stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; 回答1: one of my

Unable to create NSUrl from NSString always getting nil

…衆ロ難τιáo~ 提交于 2020-01-30 02:44:59
问题 NSMutableString *string = [[NSMutableString alloc]initWithString: @"http%3A%2F%2Fsupport24hour.com%2Fworkplace2%2Fbuttler%2Fimage.php%3Fwidth%3D534%26height%3D256%26image%3Duploads%2Fdeals%2FdealImage%2Fdeal_1383005121_IGA+Logo.JPG"]; [string replaceOccurrencesOfString:@"+" withString:@" " options:NSCaseInsensitiveSearch range:NSMakeRange(0, [string length])]; NSURL * url = [NSURL URLWithString:[string stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; 回答1: one of my

NSURLConnection Unable to http post large file

百般思念 提交于 2020-01-25 11:06:26
问题 We are trying to add in functionality into our app to allow it to POST a large file approx 50kb to our web service the file itself is a HTML template, however with the code below what we are finding is that the data seems to get cut off when the web service saves it. The web service is currently designed to check the $_POST['html'] variable and write it to a file. Is there a better way to do this and does anyone have any idea why the upload is not complete? Thanks Aaron NSString *myText;

NSURL Always Returns Nil

我们两清 提交于 2020-01-24 15:06:18
问题 I have WCF service and I want to get data from my web service. But URL always returns nil. Why? I want to send parameter to WCF which comes from text field value. For example; txtfield.text = @"ATAŞEHİR"; What's wrong ? NSString *request = [NSString stringWithFormat:@"http://www.xxxxxxxx.com/CCWCF.svc/MethodName/%@",txtfield.text]; NSURL *URL = [NSURL URLWithString:[request stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]]; I tried different things but result didn't change.

Request Timeout NSURLSession

孤街浪徒 提交于 2020-01-23 12:39:17
问题 hello I used this below code to send a request to Server. How can I add the timeout in this function static func postToServer(url:String,var params:Dictionary<String,NSObject>, completionHandler: (NSDictionary?, String?) -> Void ) -> NSURLSessionTask { let request = NSMutableURLRequest(URL: NSURL(string: url)!) let session = NSURLSession.sharedSession() request.HTTPMethod = "POST" if(params["data"] != "get"){ do { let data = try NSJSONSerialization.dataWithJSONObject(params, options:

What is the correct way to handle stale NSURL bookmarks?

一世执手 提交于 2020-01-22 05:39:29
问题 When resolving an NSURL from a security scoped bookmark, if the user has renamed or moved that file or folder, the bookmark will be stale. Apple's document says this regarding staleness: isStale On return, if YES, the bookmark data is stale. Your app should create a new bookmark using the returned URL and use it in place of any stored copies of the existing bookmark. Unfortunately, this rarely works for me. It may work 5% of the time. Attempting to create a new bookmark using the returned URL

Strange Invisible Character in String causing NSURL to fail

旧街凉风 提交于 2020-01-17 07:12:21
问题 I am having a String to Number problem that is taking me days to resolve. So it all started out in my app that involves taking a phone number from the addressbook and making a call. Everything was working fine until I noticed some phone numbers were causing my program to crash. After some time, I finally figured that they were crashing for the phone numbers that had a space in it, which finally made sense because even though it is a phone number I am using NSURL to call "tel://(555) 555 5555"