nsurl

iOS8, Swift: fileURLWithPath - missing argument for parameter error

寵の児 提交于 2019-12-14 03:24:09
问题 I am trying to append subdirectory to documents directory using method: class func fileURLWithPath(path: String) -> NSURL?` code: let applicationDocumentsDirectory:String = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as NSString let storesDirectory:NSURL = NSURL.fileURLWithPath(applicationDocumentsDirectory).URLByAppendingPathComponent("Stores") Getting error missing argument for parameter 'isDirectory' in call. I don't really get it, why compiler

Playing Sound On Button (AV Audio Player) returning nil string parameter

﹥>﹥吖頭↗ 提交于 2019-12-14 02:43:13
问题 I am attempting to play a sound on button press. Previously, I used Audiotoolbox which worked just fine with the same file type. However, i need to change to using AvAudioPlayer becuase it doesn't use the ringer volume. So last week I developed an understanding of using the audio player to play a sound on click. I had it working a treat on my over app using the exact same code. However, this app despite trying countless time will not work with AVFoundation/AudioPlayer. I have tried adding new

Strange Issue with NSURL with Xocode6.1

好久不见. 提交于 2019-12-13 23:12:04
问题 I have a strange issue with Xcode6.1 _mainURl is my ' ServerLink ' service is ' GetUserById ' NSString* str = [NSString stringWithFormat:@"%@%@",_mainURl,service]; NSURL *url = [NSURL URLWithString:str]; When I append two strings and Create a url with NSURL , url getting 'null' But, When I directly given the server link followed by serviceName I can generate URL. NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"ServerLink/GetUserById"]]; 回答1: Based on what you have written, the

iOS 8 Swift sending user directly to location services from an Alert dialog

放肆的年华 提交于 2019-12-13 18:23:35
问题 When a user has location services turned off, I want to prompt to turn them on with a UIAlertController. One of the options in the Alert Controller should take them directly to location services (for the OS, not the app). Right now, I've gotten as far as being able to send the user to permissions for my specific app, but not for the overall OS location settings. Is there a way to send the user directly to the OS Location settings from the UIAlertController? Here is the current code (located

Retrieve SSL certificate fields in the didReceiveAuthenticationChallenge

佐手、 提交于 2019-12-13 16:13:32
问题 Our application communicates with server over HTTPS. We want to re-verify the SSL certificate fields on the client side. e.g. I want to verify the CN field of the SSL certificate issues from the server during HTTPS connection. Is there way to retrieve fields information in the didReceiveAuthenticationChallenge() ? 回答1: As a refresher of how the steps of SSL are performed can be found here http://www.symantec.com/theme.jsp?themeid=how-ssl-works @Ramesh (for the function used, please have a

NSString and NSUrl not converting properly

拈花ヽ惹草 提交于 2019-12-13 15:30:28
问题 So I am trying to retrieve data from an XML stream coming from a URL. This URL is configured on a search string the user inputs. Is there any reason why this code should not be working? NSString *searchString = "Geoff"; NSString *updatedURL = [NSString stringWithFormat:@"http://mysearchpage.com/searchQuery=%@", searchString]; NSLog(updatedURL); NSURL *url = [[NSURL alloc] initWithString:updatedURL]; Now this works fine for single word searches, but as soon as I try and search for like a first

iOS Swift NSURL Web Address Not Working

故事扮演 提交于 2019-12-13 08:07:51
问题 I'm attempting to get data from a server. My URL is (for example): http://dommain.com/action When I execute let nsURL = NSURL(fileURLWithPath: url) the URL gets translated into http:/domain.com/action. Then when I execute this: let task = NSURLSession.sharedSession().dataTaskWithURL(nsURL) { (data, response, error) in print("data=\(data) response=\(response) error=\(error)") } the error property says it can't find "file:///http:/domain.com/action I'm not sure what I'm doing wrong. 回答1:

NSURL(string: fullURL) returns error

青春壹個敷衍的年華 提交于 2019-12-13 07:14:52
问题 Hello I am passing some data to webservice. This is my url http://www.website.com/mobileapp/user.php?reg_device_id=566&alert_details=[{\n \"is_active\" = 1;\n \"term_id\" = 55;\n}, {\n \"is_active\" = 1;\n \"term_id\" = 2;\n}, {\n \"is_active\" = 1;\n \"term_id\" = 111;\n}, {\n \"is_active\" = 0;\n \"term_id\" = 21;\n}, {\n \"is_active\" = 0;\n \"term_id\" = 28;\n}, {\n \"is_active\" = 0;\n \"term_id\" = 1;\n}, {\n \"is_active\" = 0;\n \"term_id\" = 5;\n}, {\n \"is_active\" = 0;\n \"term_id\"

UITableView crashing with no erros

半世苍凉 提交于 2019-12-13 06:51:53
问题 Basically, from the root of the navigation controller, a table view, I build a URL string that contains the information i want to display on the new tableView. in the new table view i use the URL for an NSURL request. My code gives me no error but crashes, right after the NSLog: made cells. help before i kill myself. sorry should all be together but copy pasting code obviously doesn't work well. #import "CatDisplayViewController.h" #import "CatViewController.h" implementation

What is the unit of the value returned by “expectedContentLength”

a 夏天 提交于 2019-12-13 04:34:45
问题 I am trying to set a data limit when doing connections.I am using the following function to get the size of the NSURLResponse . NSURLResponse *response; long long size = [response expectedContentLength]; I get the size as : 15219 Is it in bytes or bits? 回答1: expectedContentLength is set when the server provides it, such as by a Content-Length response header. Content-Length is defined by: The Content-Length entity-header field indicates the size of the entity-body, in decimal number of OCTETs