Adding a data storage stack to the documents folder
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
Adding a data storage stack to the documents folder
Hi,
I have what I know is a question with a simple answer. I’m not new to LC but I am pretty new to iOS. I just spent a bit of time building a data storage stack with lots of custom properties. I want to be able to store and retrieve the properties for my app. After building the data stack I tried to add the data stack to my app in the using the standalone settings, STACKS. No joy. So, do I add it using “copy files”? How do I add the storage stack to my app bundle? My second question is how do I insure that the data stack ends up in the documents folder in the app bundle?
Thanks,
Tom
I have what I know is a question with a simple answer. I’m not new to LC but I am pretty new to iOS. I just spent a bit of time building a data storage stack with lots of custom properties. I want to be able to store and retrieve the properties for my app. After building the data stack I tried to add the data stack to my app in the using the standalone settings, STACKS. No joy. So, do I add it using “copy files”? How do I add the storage stack to my app bundle? My second question is how do I insure that the data stack ends up in the documents folder in the app bundle?
Thanks,
Tom
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
Re: Adding a data storage stack to the documents folder
Hi Tom,
Yes, you use "Copy Files" it will end up in specialFolderPath("engine") so you have to move it from there into specialFolderPath("documents") before you can save data to it.
Simon
Yes, you use "Copy Files" it will end up in specialFolderPath("engine") so you have to move it from there into specialFolderPath("documents") before you can save data to it.
Code: Select all
put url("binfile:" & specialFolderPath("engine") & "/myData.rev") into \
url("binfile:" & specialFolderPath("documents") & "/myData.rev")
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
Re: Adding a data storage stack to the documents folder
Thanks a lot Simon. That takes a load off my mind.
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
Re: Adding a data storage stack to the documents folder
Hi Simon. Shouldn't this work? Anything after the put statement in the mouseUp handler is being ignored. What am I doing wrong?
Code: Select all
global gDataStackPath
on OpenStack
if the environment is "mobile" then
put specialFolderPath("documents") into tDataStackPath
put tDataStackPath & "/MyData.livecode" into gDataStackPath
## Need to find out when to run this
if not (there is a file gDataStackPath) then
put url("binfile:" & specialFolderPath("engine") & "/myData.livecode") into url("binfile:" \
& specialFolderPath("documents") & "/myData.livecode")
else
answer "There is a file"
end if
end openstack
Code: Select all
global gDataStackPath
on mouseUp
if the environment is "mobile" then
put the cpData[“Continents”] of stack gDataStackPath into pickList
answer pickList
end if
end mouseup
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
Re: Adding a data storage stack to the documents folder
Oh Oh I think I know this one!
Mobile is case sensitive.
The other thing is to delete the app during testing to make sure the documents folder is clean.
Simon
Edited:
Mobile is case sensitive.
The other thing is to delete the app during testing to make sure the documents folder is clean.
Simon
Edited:
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
Re: Adding a data storage stack to the documents folder
OK so you mean the file name is case sensitive? Remember I'm newish to iOS. How do I delete the app during testing?
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
Re: Adding a data storage stack to the documents folder
Yeah, best to be consistent with mobile.
Delete the app from the device, ummm... press/click and hold till everything is shaking delete the app then click on Home.
Are you on the sim or a real device?
Simon
Delete the app from the device, ummm... press/click and hold till everything is shaking delete the app then click on Home.
Are you on the sim or a real device?
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
Re: Adding a data storage stack to the documents folder
I'm on the sym. I found it. There's a reset in the pull down. I deleted the app.
MouseUp script is still not working though. It does get further along so I think fixing the case on the file name did some good. It isn't finding the properties. The mouseUp is supposed to pull that properties and populate the choices in a pickwheel. The pickwheel shows up but it's empty.
MouseUp script is still not working though. It does get further along so I think fixing the case on the file name did some good. It isn't finding the properties. The mouseUp is supposed to pull that properties and populate the choices in a pickwheel. The pickwheel shows up but it's empty.
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
Re: Adding a data storage stack to the documents folder
Better check your file
I just spent an hour copying a 0 byte stack and expecting it to work.
Simon
Code: Select all
global gDataStackPath
on mouseUp
if the environment is "mobile" then
set the defaultFolder to specialFolderPath("documents")
answer the detailed files
put the cpData[“Continents”] of stack gDataStackPath into pickList
answer pickList
end if
end mouseup
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
Re: Adding a data storage stack to the documents folder
Found the problem. When I first ran the app on the sym I had not yet attached the data stack. So it created one that was obviously empty. Resetting/deleting the app from the sym fixed the problem. All runs fine now.
Do I just set the new properties in the data stack and then save it or do I need to open it as hidden first.
Do I just set the new properties in the data stack and then save it or do I need to open it as hidden first.
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
Re: Adding a data storage stack to the documents folder
Yes.quailcreek wrote:Do I just set the new properties in the data stack and then save it...
No, but you need to CLOSE that stack nevertheless after saving it, or when your app closes!quailcreek wrote:...or do I need to open it as hidden first.
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
Re: Adding a data storage stack to the documents folder
Thanks Klaus. I added an on closeStack to save and close the data stack.
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
Re: Adding a data storage stack to the documents folder
The oddest thing just happened. The openStack handler stopped working. If I change it to preOpenStack it works. Anyone else run into this?
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14