Questions tagged [initwithcontentsofurl]
23 questions
3
votes
2 answers
Getting Argument Exception (nil URL argument)!
I'm having this problem where I get this error on my iPhone:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSConcreteData initWithContentsOfURL:options:error:]: nil URL argument'
I'm trying to parse some XML…

sridvijay
- 1,526
- 18
- 39
2
votes
1 answer
Initializing AVAudioPlayer with an iPod Song URL Using initWithContentsOfURL
I know it is possible to play iPod Songs using AVPlayer, but I cannot figure out how to initialize the AVAudioPlayer with an iPod song URL using initWithContentsOfURL. When I try, the AVAudioPlayer returns NULL upon initialization.
I need to use…

JeffB6688
- 3,782
- 5
- 38
- 58
2
votes
1 answer
Use NSDictionary 'initWithContentsOfURL' instead Reachability.h
I would like to better understand the functioning of of initWithContentsOfURL of NSDictionary.
This function manages by itself the failure of a connection?
From the initWithContentsOfURL of NSDictionary reference:
-…

Mat
- 7,613
- 4
- 40
- 56
2
votes
1 answer
How do I make initWithContentsOfURL wait for an xml page that is generated dynamically?
I am trying to send a query as part a the URL to obtain an XML file, and then trying to parse the XML file using NSXMLParser and initWithContentsOfURL. However the parser is not able to parse the file. I tested the parser with the same file, but…

MariaH
- 41
- 3
2
votes
2 answers
iPhone Development - UIImageView memory issue
Background:
Inspired from Apple's sample code ScrollViewSuite, I've created a view controller class that shows picture thumbnails and one selected picture. The hierarchy of controls for the "selected" picture is something like this:
--> UIView
…

Mustafa
- 20,504
- 42
- 146
- 209
2
votes
2 answers
initWithContentsOfURL often returns nil
NSError *error;
NSString *string = [[NSString alloc]
initWithContentsOfURL:URL
encoding:NSUTF8StringEncoding
error:&error];
When I test this on my iPhone it always works when I have wifi…

Mathias
- 233
- 3
- 17
1
vote
0 answers
Do you need to use URLSession's dataTask(with: URL) inside of an Operation class's main() method?
Do you need to use URLSession's dataTask(with: URL) inside of an Operation class's main() method?
For example:
class Downloader: Operation {
let postDetailsPage: PostDetailsPage
init(_ postDetailsPage: PostDetailsPage) {
…

Eden
- 1,782
- 15
- 23
1
vote
3 answers
What is the difference between NSString = @"HELLO" and NSString getting that same string using initWithContentsOfURL
I have a string that is getting the content from URL and when I try to use it, it doesn't work the way I thought it should.
When I initialize NSString with with contents of URL like this:
NSString *strFromURL = [[NSString alloc]…

budiDino
- 13,044
- 8
- 95
- 91
1
vote
1 answer
grabbing data from an internal file
I'm grabbing data from an external file using NSURL with the code below. If i wanted to grab this data from an internal file in my resources folder how would the code be different.
here's the NSURL code:
NSURL *dataUrl = [NSURL…

hanumanDev
- 6,592
- 11
- 82
- 146
1
vote
0 answers
NSXMLParser initWithContentsOfURL with dispatch_async( dispatch_get_global_queue(0, 0), ^{ timeout
I am using dispatch queues with NSXMLParser for getting xml data and parsing it.
The code I am using is as below:
dispatch_async( dispatch_get_global_queue(0, 0), ^{
NSURL *urlNew = [NSURL URLWithString:url_GetData];
…

Mobile Developer
- 231
- 2
- 15
1
vote
1 answer
handling error using xcode 7.0 beta in asynchronous block
I am trying to validate different errors while downloading text files from AWS S3, and with the next piece of code:
... above here function receiving String parameters ruta, archivo, archivoLocal
let directorioURL =…

Haac74
- 568
- 7
- 9
1
vote
0 answers
slow loading using initWithContentsOfUrl
I have a web service and I make HTTP calls to it from cocoa using this line of code:
NSData *imageData = [[NSData alloc] initWithContentsOfUrl:url options: NSDataReadingUncached error:&error];
Sometimes is it take 10 seconds, sometimes 30 seconds…

flacoding
- 145
- 1
- 12
0
votes
1 answer
How can I make multiple calls to initWithContentsOfURL without it eventually returning the wrong stuff?
I'm doing multiple levels of parsing of web pages where I use information from one page to drill down and grab a "lower" page to parse. When I get to the lowest level of my hierarchy, I no longer hit a new page, I basically hit the same one (with…

Troy Sartain
- 163
- 1
- 4
- 15
0
votes
1 answer
Objective-C: initWithContentsOfURL returning null
I'm working on an app that would display a remote html and use local images, so what I'm trying to do is download the HTML of the website and display it as a "local" page, that would have access to images in my bundle.
For some reason I can't get…

AragornSG
- 633
- 1
- 7
- 22
0
votes
1 answer
iOS Check if remote file has updates before downloading
This is a two part question.
I am using NSXMLParser to download an RSS feed.
NSURL *url = [NSURL URLWithString:@"linktorssxml"];
parser = [[NSXMLParser alloc] initWithContentsOfURL:url];
[parser setDelegate:self];
[parser…

NeilMortonNet
- 1,500
- 4
- 16
- 36