I guess I'm not so patient - anyway, I got past that problem, and I was hoping it's possible to write a Core Data plugin.
(I don't think that a basic UIKit plugin example would cover this question.)
I've worked out how to create a simple Core Data database in Objective C code so you don't have to set it up through the Xcode xdatamodel, but I'm having trouble creating a Persistent Store (that's where the database actually gets created on disk).
I get this message:
*callFile* stack NOT ok begin:1end:2 delta:-1
Instead of creating the Persistent Store, I substituted that command with creating a plist file to the same directory, and that was OK, and creating a directory was OK, just not the database Store.
(This is inside the plugin, so creating a plist in the plugin works.)
Does that message mean anything to you? And why would this line change the Lua stack when the plugin's not even talking to Lua at that precise moment?
Also, if I actually manage to create a database using a plugin, should I be directing it to Documents, or the player's special app subfolder documents?
Maybe you forget a lua_pop? But I cannot predict the main crashing reason.
It seems odd that if I replace that command with a simple write to plist command, then it works fine. I will continue to investigate...
To get a full path of a file (e.g. "|D|caroline.sqlite") you can add this function to your project:... ...Lua codes are executed on main thread always)
Keep in mind that you can't write to the resource folder. You need to copy your resource to the document folder and work wirth that one. Resources are read only.
So there is no writing to the iPhone Library folder? That's where I normally keep my app assets, so that I don't have to put them in the Documents folder. I do iTunes file-sharing with the Documents folder, so I don't want to expose the assets to the end user.
(By assets, I mean the app's sqlite database, which I don't want the end user to touch)
Aside note - OMG! I finally got the Persistent Store creating SUE (Stupid User Error) - fileURLWithPath is different from URLWithString b-(. Gideros plugin interface is sooo cool.
I cannot predict the side effects when you try to change the root view controller. But you can modify the root view controller of the exported project as you want.
Comments
(I don't think that a basic UIKit plugin example would cover this question.)
I've worked out how to create a simple Core Data database in Objective C code so you don't have to set it up through the Xcode xdatamodel, but I'm having trouble creating a Persistent Store (that's where the database actually gets created on disk).
I get this message:
(This is inside the plugin, so creating a plist in the plugin works.)
Does that message mean anything to you? And why would this line change the Lua stack when the plugin's not even talking to Lua at that precise moment?
My url is created from this string (and I have checked the directories exist and the file doesn't):
ie
Oh, maybe it's threading? I guess I have to do Core Data on the main thread, so it may not be possible to do this at all?
To get a full path of a file (e.g. "|D|caroline.sqlite") you can add this function to your project:
This function will return the correct full path of the file at documents folder.
(Side note: Although rendering is done on a different thread, Lua codes are executed on main thread always)
Thanks .
Or is that |R| for resources?
Likes: atilim
(By assets, I mean the app's sqlite database, which I don't want the end user to touch)