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 10-23-2010, 04:09 AM   #1 (permalink)
Registered Member
 
Join Date: Jul 2009
Posts: 17
isaaclimdc is on a distinguished road
Default NSUserDefaults or writeToFile: both not working suddenly

My app uses writeToFile:atomically: to write an NSMutableDictionary of strings to a plist and reads it at several places. The whole app was working perfectly until round about after I compiled and prepared it for ad-hoc distribution.

Now when I test the app, the data refuses to be saved. When I add a new entry, it is not written into the plist. I tried swapping to using NSUserDefaults (which is a little easier), but that also doesn't work.

What could have gone wrong during the process of packaging it for distribution??
isaaclimdc is offline   Reply With Quote
Old 10-23-2010, 05:38 AM   #2 (permalink)
Registered Member
 
Join Date: Jul 2009
Posts: 17
isaaclimdc is on a distinguished road
Default

Please helpp!! It was working perfectly fine yesterday but now it's all screwed up!!
isaaclimdc is offline   Reply With Quote
Old 10-23-2010, 08:18 AM   #3 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

You are posting very early on a Saturday morning. Most of the US is sleeping, so don't bother bumping your thread so quickly.

Without seeing some code, it is difficult to say what you are doing wrong. My guess is you are trying to write to a location that you are not allowed to write to, though the user defaults portion of the problem is puzzling. Posting some code would go a long way towards getting your problems solved.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 10-23-2010, 12:13 PM   #4 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by isaaclimdc View Post
My app uses writeToFile:atomically: to write an NSMutableDictionary of strings to a plist and reads it at several places. The whole app was working perfectly until round about after I compiled and prepared it for ad-hoc distribution.

Now when I test the app, the data refuses to be saved. When I add a new entry, it is not written into the plist. I tried swapping to using NSUserDefaults (which is a little easier), but that also doesn't work.

What could have gone wrong during the process of packaging it for distribution??
NSUserDefaults and writeToFile:atomically: both require that the entire "object graph" you are writing contain only "plist objects."

Plist objects are NSData, NSDate, NSNumber, NSString, NSArray, or NSDictionary. If you have ANY objects in your list of objects that are not one of these types, the call will fail.


I'm guessing that you added something new to the data you were trying to save that is not one of these types.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Reply

Bookmarks

Tags
nsmutabledictionary, nsuserdefaults

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: 320
11 members and 309 guests
condor304, Desert Diva, Domele, dre, dreamdash3, mottdog, oceanlablight, palme2elie, Paul Slocum, schmallegory
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,659
Threads: 94,118
Posts: 402,895
Top Poster: BrianSlick (7,990)
Welcome to our newest member, dreamdash3
Powered by vBadvanced CMPS v3.1.0

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