YYDebugDatabase is a powerful library for debugging databases in iOS applications. Which like Android Debug database
YYDebugDatabase allows you to view and edit databases directly in your browser in a very simple way.
- See all the databases.
- Run any sql query on the given database to update and delete your data.
- Directly edit the database values.
- Directly add a row in the database.
- Delete database rows.
- Search in your data.
- Sort data.
- Download database.
To integrate YYDebugDatabase into your Xcode project using CocoaPods, specify it in your Podfile
:
pod 'YYDebugDatabase'
First, add configurations in Podfile.
pod 'YYDebugDatabase', :configurations => ['Debug']
Then, run the following command:
$ pod install
import at AppDelegate.m:
#import YYDebugDatabaseManager.h
making one line code at application:didFinishLaunchingWithOptions
:
[[DebugDatabaseManager shared] startServerOnPort:9002];
#ifdef DEBUG
[[DebugDatabaseManager shared] startServerOnPort:9002];
#end
It only shows the databasesin in Documents directory and Library/Cache directory by default, if you want show databases in other directories, you can use:
- (void)startServerOnPort:(NSInteger)port directories:(NSArray*)directories
for example:
NSString *resourceDirectory = [[NSBundle mainBundle] resourcePath];
NSString *databaseDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/database"];
NSString *documentDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documnets"];
NSString *cacheDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Cache"];
[[DebugDatabaseManager shared] startServerOnPort:9002 directories:@[resourceDirectory, databaseDirectory, documentDirectory, cacheDirectory]];
That’s all, just start the application :
Now open the provided link in your browser, and you will see like this:
query:
edit:
delete:
Important:
- Your iPhone and laptop should be connected to the same Network (Wifi or LAN).
- the host of you link address is the iPhone's net address.
- If you use Simulator you can use address: http://127.0.0.1:9002.
- the port must be same as you write in Appdelegate.m
Copyright (C) 2016 y500
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.