Storing additional game content, where can we?!

+1.  Probably the best you can do for now is keep your zip on a FTP server.  Thats all I’ve been able to find a get set up.  On Android though I assume people will always be able to get at assets pretty easily.

Can the setSync be applied to an entire directory? This way I can download all the content and unzip to one directory and make sure the setSync is set to false at the directory level.

I wonder the same thing.  From looking at the documentation I thought maybe you could just call native.setSync( { iCloudBackup = false } ) without having a “file name” or “directory” included in the call that it would disable the entire document directory.

Can anyone confirm this?  I’ll try when I get home, but I just got to work so it will be a while.

Hello @shivapp, @rxmarccall,

At this point, native.setSync() works on a per-file basis. It’s not a widely-used API, and the assumption is that most developers will want to only exclude certain (large) files from iCloud backup, not an entire directory. We might reevaluate this in the future, but for now, the workaround would be to loop through the entire directory using LFS to gather up the files within, and apply the non-sync to all of them.

Best regards,

Brent

Dang that is a pain. Well thanks for letting us know at least.  @shivapp, I’ll try and post code for looping through the documents directory and setting it to not sync.

For now this is what I am doing. I am yet to test it but I am hoping it would work. I download a zip file for my content and while unzipping it I am setting the sync on it.

local function zipListener( event )

    if(event.isError) then

        print( “Unzip error” )

    else

        print( “event details:” … event.name … " " … event.type)

        if(event.response and type(event.response) == “table”) then

            for i = 1, #event.response do

                print(event.response[i])

                if(system.getInfo(“platformName”) == “iPhone OS”) then

                    native.setSync(event.response[i], {iCloudBackup = false})

                end

            end    

        end

    end

end

Woah sweet, so you are able to reference each file as the zip file is getting unzipped?

I am not sure. I will test and let you know in a day or so.

Sounds good I’ll try it as well, thanks.

On a similar note. Brent, would you know when there would be password based archiving in the zip plugin? For allowing users to download content after doing an in-app purchase this would be very helpful so malicious users can’t get our sprites or images.

+1.  Probably the best you can do for now is keep your zip on a FTP server.  Thats all I’ve been able to find a get set up.  On Android though I assume people will always be able to get at assets pretty easily.

@shivapp

Did your code that you shared above for setting “setsync” to false while a zip file is extracted end up working for you?

Yes I am able to reference each file in that for loop and can set the sync to false.

Awesome, thanks for figuring that out!

@shivapp

Did your code that you shared above for setting “setsync” to false while a zip file is extracted end up working for you?

Yes I am able to reference each file in that for loop and can set the sync to false.

Awesome, thanks for figuring that out!

Hi, just following your trails on this old thread. Wondering if any of the apps using “System.DocumentsDirectory” for downloaded and unzipped content got rejected by Apple. A short update (all ok or rejected by Apple etc) would be very appreciated. Thanks

I know people have been rejected for storing too much in system.DocumentsDirectory.  When the added the system.CachesDirectory, they were quite clear that if it can be downloaded, it needs to go there.  When they added iCloud backups, they started looking even closer at what’s being stored because iCloud storage is limited.

If you need to keep things in system.DocumentsDirectory and its more than a few kbytes in size, you probably should set the flag that tells iOS not to back it up.

Absolutely. I will use the method shared above by @shivapp and will turn off synch. I was just wondering whether @shivapp or @rxmarccall (or others) had any trouble using this approach. Thanks for your feedback.