Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-20-2010, 12:06 PM   #1 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 47
rob.mccarthy is on a distinguished road
Default Importing Info From External File

Hi All,

Basically, I have been searching for some info on how the following occurs, but have not yet come up trumphs.

I am not looking for an answer, just a link or something to the right direction so I can understand it myself.

So, the problem:

I need to be able to read a value from the internet (not bothered how it is stored yet, this can be sorted to match the solution) and pass it to a variable in my app.

Any direction welcomed.
rob.mccarthy is offline   Reply With Quote
Old 09-20-2010, 12:26 PM   #2 (permalink)
Registered Member
 
screwtape's Avatar
 
Join Date: Jul 2010
Location: Nottingham
Posts: 54
screwtape is on a distinguished road
Send a message via Skype™ to screwtape
Default Try this...

NSString Class Reference
screwtape is offline   Reply With Quote
Old 09-20-2010, 02:18 PM   #3 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 47
rob.mccarthy is on a distinguished road
Default

Hi All (again),

Thanks for the previous help, this pointed me in the correct direction. I have it sort of working, but still coming up against a problem. Here is what I have at the moment:

Code:
NSString *url =@"http://www.WEBPAGE.html";
NSString *escapedURL = [url stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSString *webpageString = [NSString stringWithContentsOfURL:[NSURL URLWithString:escapedURL]];
	
NSLog(@"webpage contents: %@", webpageString);
The problem is that I have 1 word/item in the html page, and I want to use this and transfer it to a 'String' variable.

Now when I do this, it seems to pass a value which looks the same as the HTML variable I am wanting (I can check throughout with NSLogs) BUT it doesn't seem to recognise it when I go to see if it compares with abnother string variable.

Hope this makes sense.

Quote:
Originally Posted by screwtape View Post

Last edited by rob.mccarthy; 09-20-2010 at 02:21 PM.
rob.mccarthy is offline   Reply With Quote
Old 09-21-2010, 03:38 AM   #4 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 47
rob.mccarthy is on a distinguished road
Default

Hi All,

Can anyone help today?

Thanks,

Quote:
Originally Posted by rob.mccarthy View Post
Hi All (again),

Thanks for the previous help, this pointed me in the correct direction. I have it sort of working, but still coming up against a problem. Here is what I have at the moment:

Code:
NSString *url =@"http://www.WEBPAGE.html";
NSString *escapedURL = [url stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSString *webpageString = [NSString stringWithContentsOfURL:[NSURL URLWithString:escapedURL]];
	
NSLog(@"webpage contents: %@", webpageString);
The problem is that I have 1 word/item in the html page, and I want to use this and transfer it to a 'String' variable.

Now when I do this, it seems to pass a value which looks the same as the HTML variable I am wanting (I can check throughout with NSLogs) BUT it doesn't seem to recognise it when I go to see if it compares with abnother string variable.

Hope this makes sense.
rob.mccarthy is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 313
13 members and 300 guests
2ndSegment, cayladv57, cgokey, djohnson, Domele, Hamad, linkmx, markuschow, pungs, Sloshmonster, teebee74, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,655
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, pungs
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:00 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0