nsurl

Testing file existence using NSURL

僤鯓⒐⒋嵵緔 提交于 2019-11-30 05:55:18
问题 Snow Leopard introduced many new methods to use NSURL objects to refer to files, not pathnames or Core Services' FSRefs. However, there's one task I can't find a URL-based method for: Testing whether a file exists. I'm looking for a URL-based version of -[NSFileManager fileExistsAtPath:]. Like that method, it should return YES if the URL describes anything, whether it's a regular file, a directory, or anything else. I could attempt to look up various resource values, but none of them are

Swift - NSURL error

微笑、不失礼 提交于 2019-11-30 05:33:33
问题 Getting an error when trying to use the NSURL class below, the code below is essentially trying to store an image I am pulling in from Facebook into an imageView . The error is as follows: value of optional type 'NSURL?' not unwrapped, did you mean to use '!' or '?' Not sure why this is is happening, help! import UIKit class ViewController: UIViewController { @IBOutlet weak var myImage: UIImageView! override func viewDidLoad() { super.viewDidLoad() let myProfilePictureURL = NSURL(string:

UIImagePickerControllerReferenceURL always returns nill

不打扰是莪最后的温柔 提交于 2019-11-30 04:44:20
问题 I am trying to get the name of the image which I have just captured from camera with following code. But [info objectForKey:@"UIImagePickerControllerReferenceURL"] always returning nil. How can I get the URL? - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { self.myinfo = info; NSLog(@"Dismissing camera ui..."); [self.cameraUI dismissViewControllerAnimated:YES completion:nil]; NSLog(@"Getting media url..."); NSString *mediaURL

Swift: save video from NSURL to user camera roll

纵然是瞬间 提交于 2019-11-30 01:47:49
I have a variable videoURL of type NSURL. If I call println(videoURL) it would return something like this: http://files.parsetfss.com/d540f71f-video.mp4 I have a button set up that should take this videoURL and save the video to the user's camera roll. The best I have done is this: UISaveVideoAtPathToSavedPhotosAlbum(videoPath: String!, completionTarget: AnyObject!, completionSelector: Selector, contextInfo: UnsafeMutablePointer<Void>) While I'm not even sure if this will work or not, I can't figure out how to convert videoFile:NSURL into a videoPath . Any help is appreciated on this. Edit:

Objective-C: How to add query parameter to NSURL?

风格不统一 提交于 2019-11-29 21:13:49
Let's say I have an NSURL ? Whether or not it already has an empty query string, how do I add one or more parameters to the query of the NSURL ? I.e., does anyone know of an implementation of this function? - (NSURL *)URLByAppendingQueryString:(NSString *)queryString So that it satisfies this NSURL+AdditionsSpec.h file: #import "NSURL+Additions.h" #import "Kiwi.h" SPEC_BEGIN(NSURL_AdditionsSpec) describe(@"NSURL+Additions", ^{ __block NSURL *aURL; beforeEach(^{ aURL = [[NSURL alloc] initWithString:@"http://www.example.com"]; aURLWithQuery = [[NSURL alloc] initWithString:@"http://www.example

NSUrl from NSString returns null

拈花ヽ惹草 提交于 2019-11-29 17:25:40
I want to parse the location of my Documents Directory to NSUrl from NSString I have. when my console NSLog(stringURL) i get: "/var/mobile/Applications/2B35D06D-6E4A-40F2-833E-28463A946834/Library/Application Support/MyAppDirectory" as an output. but when I do NSURL* url = [NSURL URLWithString:stringUrl]; and NSLog(url) i get (null) as an output. WHat am I doing wrong here? From the apple documentation "An NSURL object initialized with URLString. If the URL string was malformed or nil, returns nil." Your stringURL isn't a correct formed url. For reference: https://developer.apple.com/library

URLComponents.url is nil

时光毁灭记忆、已成空白 提交于 2019-11-29 16:04:55
问题 I'm trying to use URLComponents to compose a URL as that appears to be what it's for. However, when I then access the url property of the components it is nil. Example... var urlComponents = URLComponents(string: "http://google.com")! urlComponents.path = "auth/login" Then I do ... print(urlComponents) Output... scheme: http host: google.com path: auth/login - scheme : "http" - host : "google.com" - path : "auth/login" But then... print(urlComponents.url) outputs nil . Am I doing something

What to do about an NSURLErrorDomain -999? [duplicate]

余生长醉 提交于 2019-11-29 14:31:33
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: How do I fix NSURLErrorDomain error -999 in iPhone 3.0 OS I have an iphone app, built with Jqtouch and phonega,p framework successfully made and submitted to the appstore several times. Then I updated to the new phonegap1.0.0, and then started getting errors related to something called webview. Eventually was advised to create new xcode project and import the old www folder into it. There are now no more errors

NSURL URLWithString:myString returns Nil?

拥有回忆 提交于 2019-11-29 14:16:23
问题 I have a string of my url.. I want to get data from that url. For that I needs to create object of NSURL . The problem is while I try URLWithString method of NSURL class it returns nil. But when I opens this link in Safari of My Mac it display me the Image. I am using .. NSString *str = @"http://chart.apis.google.com/chart?chs=150x150&cht=qr&chld=L|0&chl=http://MyServer.com/shareMyCard.php?value=1304057103"; NSURL *url = [NSURL URLWithString:str]; NSData *data = [NSData dataWithContentsOfURL

NSURL returns Nil Value

若如初见. 提交于 2019-11-29 13:46:12
Here Below is my code NSString *string = [NSString stringWithFormat:@" http://abc.com /Demo/View.php?drinkId=%@&name=%@&comment=%@&date=%@&rating=%@& ReqestType=SubmitComment",DrinkId,Name,Comment,Date,Rating]; NSURL *url = [[NSURL alloc] initWithString:string]; Here in string there is value but url returns nil. Can Anyone tell why this happened. Thanks .... "This won't work, so here's what I did instead" NSString *string = [NSString stringWithFormat:@"http://abc.com/Demo/View.php?drinkId=%@&name=%@&comment=%@&date=%@&rating=%@&ReqestType=SubmitComment",DrinkId,Name,Comment,Date,Rating]; NSURL