Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Reading data from the web
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Reading data from the web



Hi student-dev-ers,

I'm trying to give my application access to information online (so that it can automatically detect software updates). However, I'm having no luck actually getting it to read the data. For instance, I adapted the code at http://developer.apple.com/documentation/Cocoa/ Conceptual/Strings/Articles/readingFiles.html to get:

NSString *path = @"http://www.graphsketcher.com/update/ com.robinstewart.GraphSketcher.plist.txt";
NSError *error;
NSString *stringFromFileAtPath = [[NSString alloc]
initWithContentsOfURL:[NSURL URLWithString:path]
encoding:NSUTF8StringEncoding
error:&error];
if (stringFromFileAtPath == nil) {
// an error occurred
NSLog(@"Error reading URL at %@\n%@",
path, [error localizedFailureReason]);
}


Which results in:
"Error reading URL at http://www.graphsketcher.com/update/ com.robinstewart.GraphSketcher.plist.txt
(null)"


Despite the fact that the URL is readily accessible via web browser. Have any of you done this kind of thing successfully?

Thanks,
Robin
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Student-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.