Can UILabel's drawTextInRect method be overridden to change the size of UILabel's text?
I'm developing an iPhone app that uses the built-in SQLite database. I'm trying to view and open the database via the
sqlite3 command line tool so I can execute arbitrary SQL against it.
When I run my app in the simulator, the
.sqlite file it creates is located at
~/Library/Application Support/iPhone Simulator/User/Applications/.
How can I see that file on the physical iPhone?
1:Attaching another modem to an iPhone or gPhoneBlack UITableViewCell DetailDisclosure accessory button?
Instructions for Xcode 6.0.1.
- Xcode > Open > YourProject
- Xcode > Product > Run
- Xcode > Window > Devices
- (Column 1 - select) Devices > YourDeviceName
- (Column 2 - select) Installed Apps > YourAppName
- (Column 2 - select) Cog under 'Installed Apps' list
- (Pop-Up - select) Download Container...
- Save to location
- Right click on 'YourAppName.xcappdata'
- Select 'Show Package Contents'
- AppData > Documents > YourDatabase.sqlite
This one works if you jailbreak your iPhone.. i don't know why anyone would have any issues with jailbreaking their phone as i've been using it for development for quite any time and found no problems, also it is not uncommon for sqlite to perform differently
on the device vs simulator:.
- jail break your phone (there tutorials all over the web)
- set your cydia user level to developer
- install sqlite3 into your phone: go to cydia > manage > sources > cydia/telesphoreo > sqlite3
- ssh into your phone using iphone tunnel root ssh password: "alpine"
which sqlite3 to ensure you have it installed
- browse to the location of your db.. a breakpoint in your code should tell you where it is located.. in my code it looks any thing like this.
notice this if you run this on the simulator.. you'll receive a location like the following:
NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex: 0]; NSString *pathName = [documentsDirectory stringByAppendingPathComponent:filename]; return pathName;
/Users/admin/Library/Application Support/iPhone Simulator/6.0/Applications/42302574-7722-48C1-BE00-91800443DA7C/Documents/email-524200.edb.
on the device it will look like this:
. then just type
and you must execute sql statements right on your phone.. without copying it over or whatever.
Exactly in the same way you did on the simulator. There are very few (important) differences between the device and simulator, and file access and library loading are for the most part not part of them..
In XCode 4, you did the same as Lounges suggested, which will save the whole file structure for your app to your destination of choice. Rename the .xcappdata file which is saved to .sqlite so you must open it by double clicking, then you must find the file from the device..
The Easiest way to did it by far is using iExplorer to download the file from your app. and then use SQLite Professional read-only
to read the file. Even thought it is not realtime although at least it is free. :-).
Your question remains a little vague. "See" in what sense? Do you create the SQLite database? How? Have you placed it manually in the Simulator's filesystem area? Are you perhaps asking how to did this on the iPhone?. The easiest way is to precreate an empty database with the sqlite3 command-line tool, have it as a resource in your application, then copy it in your application sandbox's documents folder. You must receive the path to your resources folder via NSBundle's pathForResource:ofType: method, then grab the path to your Documents folder via NSSearchPathForDirectoriesInDomains() for the NSDocumentsDirectory folder in the NSUserDomainMask, then copy the file via NSFileManager's methods.. Otherwise, you must use SQLite's functions to create a new database from scratch by supplying appropriate SQL commands to define its schema..
The Download Container method is the one I found to be the best. However, you have to be careful this any times, if you try to e-mail it or attach it from within the app then the file this is sent out would be empty..