3 Replies
      Latest reply on May 14, 2019 8:25 AM by jonprescott
      mickeyangelo Level 1 Level 1 (0 points)

        Hi there,

        I have a very large piece of content, text string data manipulated in a way that is pre-indexed for it's non conventional multi-tasking.

        I have sandboxed datastores to contain the correct data when added in the code, but looking for an efficient solution, which is not a plist, that I can have the data ready to go, rather than have to be added and processed in the users first open of the app.

        Ideally this wouldnt be from a cloud, as I would like the app to work offline.

        any solutions / tutorials in the right direction would be appreciated

        Thanks

        • Re: Datastore with content preloaded
          jonprescott Level 2 Level 2 (70 points)

          If you don't want to rely on the Internet to get the initial copy, It would seem that the content needs to provided as part of the application, for at least the application's first use.  You could put the initial copy in the Resources folder as part of the application build process, and it would be available to you when the application is first used.  The downside is that it will be part of the application signage, so you can't modify it within the application bundle, and it will always be there for the life of the application.  This may or may not be an advantage, especially if it's a "constant".  Also, if the application gets updated that requires a change to this data, you can provide as part of the upgrade process for the application.  It can be any disk file you want, in whatever format you want as long as Xcode can copy it (or you can build a Run script to copy it) to your Resource folder.

            • Re: Datastore with content preloaded
              mickeyangelo Level 1 Level 1 (0 points)

              Thanks Jon,

              This may have to be a back up plan, though I've just reviewed what references the text strings would have, and would be preferable to have array[ ][ ] references to each string item, so their relationships are easily managed. I can see that I could do that in a .csv or similar, however the disadvantage would be its requirement the whole item to parse on the initial loading. If I had it in a persistant datastore format, is that possible to store in the Resources Folder? Or can this type only exist after a 'first load' inside the code?

              thanks.

                • Re: Datastore with content preloaded
                  jonprescott Level 2 Level 2 (70 points)

                  Not sure if you've solved this (I've been away for awhile).  However, to answer your question, as far as I know, everything in the Resource Folder has to be read-only when using the application.  So, you have to create the persistent store for your ongoing activity somewhere else (~/Library/Application Support, et al) when you first start up.  The initial content can be anything you can copy during the build phases, but, the initial content cannot be changed while the application is running, even initially.

                   

                  I would submit that the .csv file is an example of a persistent store, but, as you mentioned, you would have to parse it.  If you build an initial Core Data store, for example, as part of the build process, you would still have to copy it someplace else before you modified it.  If you do not intend to modify the database, you could copy it into the Resource Folder and store it there.  However, any change you make, even inadvertent changes, as the application runs, will affect the application signing, and could cause the application not to launch next time around.