Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

make it easy to debug databases in iOS applications iOS debug database

License

NotificationsYou must be signed in to change notification settings

y500/iOSDebugDatabase

Repository files navigation

YYDebugDatabase is a powerful library for debugging databases in iOS applications. Which likeAndroid Debug database

YYDebugDatabase allows you to view and edit databases directly in your browser in a very simple way.

What can YYDebugDatabase do?

  • 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.

Release 2.0.0:

  • Replace CocoaAsyncSocket with GCDWebServer, which is higher level server that more convenient.
  • Satisfy with Firefox, Safari, Chrome.
  • Use bonjourname as the server address, for example:http://y500.local,http://macbook.local:9002...
  • print link address and bonjour name of the server in the console

Installation

Podfile

To integrate YYDebugDatabase into your Xcode project using CocoaPods, specify it in yourPodfile:

pod'YYDebugDatabase'

If use Swift, remember to adduse_frameworks!

use_frameworks!pod'YYDebugDatabase'

Carthage

  • Cartfile
github "y500/iOSDebugDatabase"
  • runcarthage update

  • Add all three.frameworks to your target "Embedd Frameworks" Build Phase:

    • iOSDebugDatabase.framework
    • FMDB.framework
    • GCDWebServers.framework

Not build in Release

First, add configurations in Podfile.

pod'YYDebugDatabase',:configurations=>['Debug']

Then, run the following command:

$ pod install

USage

import at AppDelegate.m:

#import DebugDatabaseManager.h

making one line code atapplication:didFinishLaunchingWithOptions:

[[DebugDatabaseManagershared]startServerOnPort:9002];

Not run in Release

#ifdef DEBUG[[DebugDatabaseManagershared]startServerOnPort:9002];#end

If use Swift:

import at Appdelegate.swift:

import YYDebugDatabase

making one line code atapplication(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?):

DebugDatabaseManager.shared().startServer(onPort: 9002);

Advanced

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 = [[NSBundlemainBundle]resourcePath];NSString *databaseDirectory = [NSHomeDirectory()stringByAppendingPathComponent:@"Documents/database"];NSString *documentDirectory = [NSHomeDirectory()stringByAppendingPathComponent:@"Documents"];NSString *cacheDirectory = [NSHomeDirectory()stringByAppendingPathComponent:@"Library/Cache"];    [[DebugDatabaseManagershared]startServerOnPort:9002directories:@[resourceDirectory, databaseDirectory, documentDirectory, cacheDirectory]];

If use Swift:

letdirectory:String=(Bundle.main.resourcePath)!;letdocumentsPath:String=NSSearchPathForDirectoriesInDomains(.documentDirectory,.userDomainMask,true)[0]letcachePath:String=NSSearchPathForDirectoriesInDomains(.cachesDirectory,.userDomainMask,true)[0]DebugDatabaseManager.shared().startServer(onPort:9002, directories:[directory, documentsPath, cachePath]);

That’s all(you can look at the Demo for details), 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

###other more:

you can find the address and bojourname address in the console like below:

[INFO] DebugDatabaseManager started on port 9002 and reachable at http://192.168.0.67:9002/[INFO] DebugDatabaseManager now locally reachable at http://y500.local:9002/

License

   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.

About

make it easy to debug databases in iOS applications iOS debug database

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors3

  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp