Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9003261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:41:23+00:00 2026-06-16T00:41:23+00:00

I have an iOS app that implements a custom subclass of UIDocument that encapsulates

  • 0

I have an iOS app that implements a custom subclass of UIDocument that encapsulates a file wrapper on a package of data, archived objects and images. I initially converted the implementation to UIDocument for iCloud support but it has been too unreliable and so I am pulling out the iCloud portion and just using a UIDocument with local storage.

When the user modifies the data I send updateChangeCount: to the UIDocument instance and it periodically autosaves in the background. I only close the document when the application goes to the background. I’ve discovered that after an autosave which calls my contentsForType method of UIDocument a loadFromContents is also called. I don’t understand this logically and it is also causing problems with my interface.

I thought loadFromContents would only be called when opening the document or if an iCloud document was modified on another device. So when my document autosaves in the background it also re-loads which causes an update of the UI which can sometimes discard new work in progress that hasn’t been saved. I could ignore the re-loading in the UI but I’d still have some problems with my model data being different than the UI objects.

So what am I doing wrong to cause this behavior? I would like to have a save not initiate a loadFromContents or understand how to handle that behavior.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:41:24+00:00Added an answer on June 16, 2026 at 12:41 am

    I discovered that this behavior was somehow due to some @synchronized calls I had wrapped contentsForType and the writeContents: methods with on initial implementation to prevent crashes when closing the document with unsaved changes. I was getting two near simultaneous calls to contentsForType that caused bad access errors.

    I found a cleaner way to prevent these crashes by setting updateChangeCount:UIDocumentChangeCleared before closing the document.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an iOS app that pulls user data down from a web service
I have an iOS app that uses a number of enums for valid values,
I have an old iOS app that I never distributed and am now trying
I have a Rails app that has 2 clients -- an iOS app reads/writes
I'm doing an iOS app that crawl my youtube subscription's videos. I have a
I have an iOS app with a UITableView that has flexible width, which allow
In my iOS app I have several UIElement s that can process user input:
I have an app on my iPhone that was built on iOS 5 and
I currently have an iOS app that allows people to submit content to our
new to iOS development, i have managed to create a basic app that can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.