Populating Database #17
Comments
That's a good question. You could help me with this: Put something inside the |
For now, I added a empty Documents.zip file to the project target and wrote a script that uses curl to download different Document.zip files from the web and replaces the empty Documents.zip file in the project just before it starts the build. (I didn't want my 35MB sample database to be in my git repo) I'm interested in testing out injecting it into the .app after build as this will allow me to use localised workout data for different regions (eg. a Run in Japan or a Bike in London. Thanks for the great tool! |
You can still download localised data from your app, since you can easily detect the locale while running the app. |
I just successfully integrated it - in your folder_name = "ExampleDocuments"
setup_for_language_change do |lang, device|
puts "Copying example files to .app"
app_path = "/tmp/snapshot/build/app_name.app/"
FileUtils.mkdir_p(File.join(app_path, folder_name))
Dir.glob(File.join(example_files, '*')).each do |example_path|
FileUtils.cp_r(example_path, File.join(app_path, folder_name)) rescue nil # in case the file already exists
end
end |
Did any of you guys manage to replace an empty |
I think the documentation is quite lacking in this regard. It took me a long time to get this working. The current example could use some data from the Documents folder, and use this hook to populate it for screenshots. Anyway, in case someone needs help: I used the script in the previous comment, putting it into "test_data", and then I did this in my app delegate did finish launching:
I think this should work for Core Data databases too. |
Interesting, I was messing with |
Take a look at how MindNode implements the How could I improve the documentation? With more sample code and how it works? |
I want to avoid having any CoreData importing code in the app, as I really don´t need it otherwise. Sure, maybe linking to the mind node example here could help. https://github.com/KrauseFx/snapshot#custom-callbacks-to-prepare-your-app I was a little disappointed to see |
This issue was migrated to fastlane/fastlane#2733. Please post all further comments there.
|
Hi,
In your demo you use the example of populating the database, if you did run a script to pollute the database then I guess you would need to know the path of the .app?
I am trying to work out how I can preload a workout database onto the simulator app so I have some data for the screenshots.
Thanks
setup_for_language_change do |lang, device|
puts "Running #{lang} on #{device}"
system("./popuplateDatabase.sh")
end
The text was updated successfully, but these errors were encountered: