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 12-04-2011, 12:07 AM   #1 (permalink)
Registered Member
 
Join Date: Feb 2011
Posts: 17
ApplicaPhone.com is on a distinguished road
Default Retrieve many apps data from itunes using Json in Xcode

I'm working in some iPhone app thats shows many apps from the app store and I want to get their info using json.

I was able to do that for a single app, but now i'm trying to get info for all my apps that i stored their identifiers used in the JSon URL, in an NSMutableArray.

The problem that I get the info for only the first item in my array, and for the others I get this error :

Code:
-JSONValue failed. Error trace is: (
"Error Domain=org.brautaset.JSON.ErrorDomain Code=11 \"Unexpected end of string\" UserInfo=0x4b661c0 {NSLocalizedDescription=Unexpected end of string}"
I'm using those methods to get info from the app store using json :

Code:
-(void)loadDatawithCode:(NSString*)_code
{
self.responseData = [NSMutableData data];
 
NSString * url = [NSString stringWithFormat:@"%@%@",@"http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/wa/wsLookup?id=",_code];
 
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
 
[[NSURLConnection alloc] initWithRequest:request delegate:self];
 
}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
[connection release];
 
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
self.responseData = nil;
 
NSArray* results = [(NSDictionary*)[responseString JSONValue] objectForKey:@"results"];
[responseString release];
 
 
tmpApp= [[App alloc]init];
 
// assuming you have 1 valid entry
NSDictionary *result = [results objectAtIndex:0];
 
tmpApp.price = [result objectForKey:@"price"];
tmpApp.name=[result objectForKey:@"trackCensoredName"];
tmpApp.icon=[result objectForKey:@"artworkUrl60"];
 
NSLog(@"application : %@ , Price : %@ , icon path : %@",tmpApp.name, tmpApp.price,tmpApp.icon);
 
}
Someone may have an idea? thanks.
ApplicaPhone.com 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: 404
14 members and 390 guests
7twenty7, AppsBlogger, Clouds, David-T, Duncan C, EvilElf, HemiMG, heshiming, iekei, LunarMoon, Murphy, sacha1996, Sami Gh, teebee74
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,127
Posts: 402,915
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

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