I asked the question in quote email two days ago with no response so let me try 
a related, but perhaps more concise/simpler question:

Is it even necessary to call -saveToURL:forSaveOperation:completionHandler in a 
UIManagedDocument subclass or will its autosaving mechanism take care of that 
at all times, including requesting extra time with a [[UIApplication 
sharedApplication] beginBackgroundTaskWithExpirationHandler: block when 
necessary. 

In other words, can I remove all calls to 
-saveToURL:forSaveOperation:completionHandler other than the one used to create 
a new file? I am not currently using iCloud.

The symptom I'm seeing is about 1% of the people who have purchased my app are 
losing the data files (they seem to have zero size). I can't reproduce it and 
I've been using the app for 8 months while developing it without ever seeing 
this. I don't know if it's a save issue or if perhaps something such as a 
required entity attribute not getting set that is leading to the zero length 
file.

I would be extremely grateful for any suggestions on how to track this down as 
I've temporarily pulled the app from the store until I can figure this out.

Thanks,
Dave



On Aug 28, 2012, at 10:17 PM, [email protected] wrote:

> 
> This is on iOS 5 and higher. 
> 
> I have an iOS app that can open separate data files (one open at a time) 
> using a UIManagedDocument subclass. 
> 
> When I do a -saveToURL:forSaveOperation:completionHandler
> 
> do I need to that inside a: 
> 
> [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:
> 
> block in case the application enters the background and will be terminated 
> before the save operation completes? Or does UIManagedDocument take care of 
> that for me?
> 
> Also, my app delegate's
> 
> - (void)applicationDidEnterBackground:(UIApplication *)application
> 
> do I need to call:
> 
> - (void)closeWithCompletionHandler:(void (^)(BOOL success))completionHandler
> 
> 
> and then reopen it in:
> 
> - (void)applicationWillEnterForeground:(UIApplication *)application
> 
> 
> Or can I just call:
> 
> -saveToURL:forSaveOperation:completionHandler
> 
> in 
> 
> - (void)applicationDidEnterBackground:(UIApplication *)application
> 
> without worrying about closing the file if the app is later terminated?
> 
> Thanks,
> Dave
> 
> _______________________________________________
> 
> Cocoa-dev mailing list ([email protected])
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/davelist%40mac.com
> 
> This email sent to [email protected]

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to