Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSString to NSURL?

Trying to convert a string to NSURL and this is not happening.

barcodeTextLabel.text = foundCode.barcodeString;
urlToGrab = [NSString stringWithFormat:@"%@", foundCode.barcodeString]; // foundCode.barcodeString is an NSString

urlToGrab shows the following "error invalid CFStringRef"

like image 643
jdog Avatar asked Nov 14 '11 03:11

jdog


2 Answers

This is how you create an NSURL from an NSString:

NSURL *url = [NSURL URLWithString:@"http://www.google.com"];
like image 70
Dimme Avatar answered Sep 20 '22 05:09

Dimme


You can use following for creating the file path to url.

NSURL *yourURL = [NSURL fileURLWithPath:@"/Users/xyz/Desktop/abc.sqlite"];
like image 3
swapnali patil Avatar answered Sep 24 '22 05:09

swapnali patil