How do I clear out old databases in sqlite3? (version 3.7.12)
I am building an iOS (Xcode) app using sqlite3.
I deleted the dbase file (in /Users/xx/Library/Application Support/iPhone Simulator/6.1/Applications/nnn/Documents). I destroyed the copy in the xcode navigation panel. I trashed the copy in the project bundle. And I removed its reference in Build Phases/Copy Bundle Resources.
As a test, I did not try to put in a new db file. Only the source code remains [[SQFXDB alloc] initWithSQFXDBFilename:#"sqfx_v4b"];.
And build succeeds. And Run succeeds. And the data is still there in the simulator. And a new database file has been created in the ../Documents dir. All the original data is there.
Can anyone enlighten me?
Thanks, Dave
Delete app from simulator/Reset Contents and Settings for simulator - run from XCode
Related
I'm getting an error while trying to run the app on the simulator, using Xcode 12.4
/Users/apple/Library/Developer/Xcode/DerivedData/CCBC-
exyindmimlkaxncxdeubzcgqxqgc/Build/Intermediates.noindex/CCBC.build/Debug-iphonesimulator/CCBC.build/Script-7DBCCAD36C20635EF76D902C.sh: line 4: /Users/apple/Desktop/MyProjects/CCBC_iOS/CCBC.xcodeproj/xcuserdata/.xcassets/Asset.xcasset: No such file or directory
When I select the Asset.xcasset from files in Xcode it shows the file path as /CCBC_iOS/CCBC/Asset.xcasset
Thanks for your help
For me, I had to delete an old script that references this Asset file to be built within Derived Data. Regardless of how much I deleted Derived Data and cleared Build Folder, this script still runs the XCAssets reproducing this bug. I would recommend checking out your Build Phases and Scripts and removing unnecessary files especially for old projects.
I want to access an sqlite database file which I have bundled to my iOS application.
This works fine, because I can see I can read/write from/to the database by the application logic.
If I run the application by the simulator I can find the database here:
file:///Users/<Username>/Library/Developer/CoreSimulator/Devices/<DeviceID>/data/Containers/Bundle/Application/<ApplicationID>/<AppName>/test.db
But if I run the application on a real device it seems difficult to access the data, In Xcode I've tried to export the container in "Devices and simulators", download it, open the package content of the .xcappdata file but I can't find the file "test.db":
Where and How can I access the file?
Xcode will not import the Application part which contains the binary and all the files you bundle with it.
When working with an file which is bundled in your app it is better to copy it into Library or Document directory the first time the application is run. So you never modify the bundle one which should only be a init file and not a working file.
When it is in Document or Library, you can then get it via xCode.
This may have been my fault, but I am not sure how to fix the issue. I wanted to change the data installed with my app. Instead of modifying the data in the original sql file in the project, I deleted the sql file from my project and added a new one (with the same name).
Now when I run the app in a simulator it cannot find the sql file. The sql file is also not in the local directory where all my simulator run files are.
I have tried cleaning the build, deleting and cleaning and re-adding, etc.., but my sql file fails to be copied to the simulator directory.
When I deleted the file I removed the reference. Where is this "reference"? I suspect that when I try to re-add the file, it doesn't recreate the reference.
I do not want to have to change the name of the database if that can be avoided.
Edit: Adding a screenshot that shows that file is not included in the target (in this case AmeldaiPhone).
After checking the checkbox for the target, the file still does not appear in the simulator directory:
Path to simulator directory:
Contents of simulator directory (where the sql file always showed up before):
Update: I have revised my project file and the sql file still does not show up in the build. I have determined that this is an issue with the specific target, which was created after the sql file was added. The sql file shows up fine in the build of the original development target.
I do not know why this is happening, but I was able to fix my own problem by unchecking the development target for my sql file, and cleaning and building. The file then appears in my deployment target..
Unchecked development target, checked deployment target..
Path to simulator directory:
File appears in simulator directory.
That seemed to unstick whatever weird thing was stuck. The file is now included in all target builds.
Creating a build for my Xcode project takes too much time. It gets stuck at "Copying swiftdocs". I am making a build to run on device. I cant understand why this is happening. No relevant info available on internet. Just for the info, I am using Cocoa Pods in the project.
Is it anywhere related to pods? I am unable to run the app on device.
Xcode stuck indexing error (compiling model, copying swiftdocs, etc.)
Open your Project Folder.
Find ProjectName.xcodeproj file.
Right-Click Copy and Paste to Safe Place.
Right-Click Show Package Contents.
Find project.xcworkspace file and delete that file.
Reopen Your Project and clean and Rebuild.
If your problem is not solved then replace the file with your backup file.
Hope this will work for you. If still not restart your mac some time it works with restart.
I run an application test from XCode on my device.
The test creates some files on the device.
After the tests has finihsed i would like to copy these file from the device to my machine.
Does anyone know how to achieve that?
I am using XCode 4.6.2
thanks
Christian
Assuming the files are created in the Documents directory, you can use iTunes file sharing to get the files.
Here's a tutorial
EDIT based on comment
Not sure if this fits your use case - you could try integration with the Dropbox API. Your app, once the files are created, can sync the files in a Dropbox folder. You can have the Windows/Mac app installed to have the files synced to your computer as well.