Data Stacks too big for Apple
Posted: Sun Jul 28, 2013 10:04 pm
I've had an app rejected a couple of times by Apple to due data stacks being too big. They suggest that I set the stack files' "do not backup" attribute. The problem that I'm running into is that I cannot seem to set the attribute for a stack residing in the "engine" area.
When a user opens the app for the first time, it throws a copy of the "engine" stack into the documents area. The app uses the "documents" stack to maintain data within the app. At some point, however, users will want to reset the app to its baseline. When this happens, the "engine" stack is once again copied to the "documents" stack.
The code below executes when the "Launcher" stack is initially opened. The "documents" stack successfully has its "do not backup" flag set, but the "engine" stack does not.
I've seen posts where folks suggest that rather than use the documents area, the cache area should be used. I'm concerned that this would not work as users may lose the data stacks if the cache folder is flushed.
Any help would be greatly appreciated!
-- Mike
--------------------------------------------------------------------------------------
on preopenstack
if the environment is "mobile" then
put (specialFolderPath("Documents") & "/ShipCards.livecode") into tPathToDatabase
put (specialFolderPath("engine") & "/ShipCards.livecode") into tPathToStartLoc
try
if not (there is a file tPathToDatabase) then
put url ("binfile:" & tPathToStartLoc) into temp
put temp into url ("binfile:" & specialfolderpath("Documents") & "/ShipCards.livecode")
wait 5 milliseconds with messages
end if
catch pErr
answer pErr
end try
-- Set do not backup flag
iphoneSetDoNotBackupFile tPathToDatabase, true
iphoneSetDoNotBackupFile tPathToStartLoc, true
if iphonedonotbackupfile(tPathToDatabase) is false then
answer "Documents Attribute Not Set"
else
answer "Documents Attribute Set!"
end If
if iphonedonotbackupfile(tPathToStartLoc) is false then
answer "Engine Attribute Not Set"
else
answer "Engine Attribute Set!"
end If
end if
end preopenstack
When a user opens the app for the first time, it throws a copy of the "engine" stack into the documents area. The app uses the "documents" stack to maintain data within the app. At some point, however, users will want to reset the app to its baseline. When this happens, the "engine" stack is once again copied to the "documents" stack.
The code below executes when the "Launcher" stack is initially opened. The "documents" stack successfully has its "do not backup" flag set, but the "engine" stack does not.
I've seen posts where folks suggest that rather than use the documents area, the cache area should be used. I'm concerned that this would not work as users may lose the data stacks if the cache folder is flushed.
Any help would be greatly appreciated!
-- Mike
--------------------------------------------------------------------------------------
on preopenstack
if the environment is "mobile" then
put (specialFolderPath("Documents") & "/ShipCards.livecode") into tPathToDatabase
put (specialFolderPath("engine") & "/ShipCards.livecode") into tPathToStartLoc
try
if not (there is a file tPathToDatabase) then
put url ("binfile:" & tPathToStartLoc) into temp
put temp into url ("binfile:" & specialfolderpath("Documents") & "/ShipCards.livecode")
wait 5 milliseconds with messages
end if
catch pErr
answer pErr
end try
-- Set do not backup flag
iphoneSetDoNotBackupFile tPathToDatabase, true
iphoneSetDoNotBackupFile tPathToStartLoc, true
if iphonedonotbackupfile(tPathToDatabase) is false then
answer "Documents Attribute Not Set"
else
answer "Documents Attribute Set!"
end If
if iphonedonotbackupfile(tPathToStartLoc) is false then
answer "Engine Attribute Not Set"
else
answer "Engine Attribute Set!"
end If
end if
end preopenstack