New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
iOS Development Discussion on developing apps for the iOS platform.

offline json access


Post Reply New Thread Subscribe

 
Thread Tools
brinthusha

 
Member Since: Jun 03, 2013
Posts: 1
brinthusha is on a distinguished road

brinthusha is offline
Hi
in my app, need to download the json data for the 1st time when the user install the app , then for the 2nd time need to reuse the downloaded data even witout internet connection also. for that i have used "NSUserdefault" but i couldnt access the data in offline.. please help me to sort out this issue.. im really fed up... this is my code:

//load json

-(void)viewDidAppear : (BOOL)animated
{

_feed = [[data alloc] initFromURLWithString : @"http://www.fr6.wearedesigners.net/WAD/index.php/wad/getProject"
completion:^(JSONModel *model, JSONModelError *err) {


//json fetched
NSLog(@"Projects: %@", _feed.Projects);

//reload the table view
[self.collectionView reloadData];
}];
}


-(NSInteger)collectionView : (UICollectionView *)collectionView numberOfItemsInSection : (NSInteger)section
{
return _feed . Projects . count;
}

-(UICollectionViewCell *)collectionView : (UICollectionView *)collectionView
cellForItemAtIndexPath : (NSIndexPath *)indexPath
{

NSUserDefaults *saved=[NSUserDefaults standardUserDefaults];

model* bankIcons=_feed . Projects[indexPath . row];

[saved setObject : bankIcons . logo forKey : @"_feed"];

[saved synchronize] ;

NSString *savedval=[[NSUserDefaults standardUserDefaults]stringForKey : @"_feed"];


custom *cell = [collectionView
dequeueReusableCellWithReuseIdentifier : @"Cell"
forIndexPath : indexPath];

UIImage *image = [UIImage imageWithData : [NSData dataWithContentsOfURL : [NSURL URLWithString:savedval]]] ;
cell.displayImage.image = image ;

return cell ;

}
QUOTE Thanks

Post Reply New Thread Subscribe


« Devicelogs depand on iOS versions | Installing iOS 7 on an iPhone that has never been synced »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
LDAP Offline Access Kernewek OS X - Operating System 1 01-18-2012 11:07 AM
Microsoft access and STATA on Mac, bootcamp vs Parallels Henrymac Running Windows (or anything else) on your Mac 4 11-08-2011 02:36 PM
Keep losing web access but still have internet jmullenberg Internet, Networking, and Wireless 1 04-13-2009 01:25 PM
no access to my hard drive no icon after I log in Johawk01 Apple Desktops 5 08-19-2008 12:42 PM

All times are GMT -4. The time now is 05:03 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?