square / PonyDebugger

Remote network and data debugging for your native iOS app using Chrome Developer Tools
Other
5.86k stars 595 forks source link

my project didn't get to use PonyDebugger on Swift Project. #147

Closed shiratsu closed 9 years ago

shiratsu commented 9 years ago

Hi,there.

I am trying to use PonyDebugger on Swift. However i didn't. My project is producing this error. 2015-04-13 21 18 04

AppDelegate.h is following code.

//
//  AppDelegate.swift
//  ShotAlertForSwift
//
//  Created by 平塚 俊輔 on 2/24/15.
//  Copyright (c) 2015 平塚 俊輔. All rights reserved.
//

import UIKit
import Realm
import Fabric
import Crashlytics

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.

        // copy over old data files for migration
        let defaultPath = RLMRealm.defaultRealmPath()
        let defaultParentPath = defaultPath.stringByDeletingLastPathComponent
        let v0Path = NSBundle.mainBundle().resourcePath!.stringByAppendingPathComponent("shotalert.realm")
        NSFileManager.defaultManager().removeItemAtPath(defaultPath, error: nil)
        NSFileManager.defaultManager().copyItemAtPath(v0Path, toPath: defaultPath, error: nil)

        Fabric.with([Crashlytics()])

        //あまり残しておきたくないので、使わない際は消す
        let ponyDebugger = PDDebugger.defaultInstance()
        ponyDebugger.enableNetworkTrafficDebugging()
        ponyDebugger.enableViewHierarchyDebugging()
        ponyDebugger.setDisplayedViewAttributeKeyPaths(["frame", "hidden", "alpha"])
        ponyDebugger.forwardAllNetworkTraffic()
        ponyDebugger.connectToURL(NSURL(string: "ws://localhost:9000/device"))

        return true
    }

    func applicationWillResignActive(application: UIApplication) {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
    }

    func applicationDidEnterBackground(application: UIApplication) {
        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    }

    func applicationWillEnterForeground(application: UIApplication) {
        // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
    }

    func applicationDidBecomeActive(application: UIApplication) {
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }

    func applicationWillTerminate(application: UIApplication) {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    }

}

It's project bridging header is following code.

//
//  ShotAlertForSwift-Bridging-Header.h
//  ShotAlertForSwift
//
//  Created by xxxxxxxx on 3/23/15.
//  Copyright (c) 2015 平塚 俊輔. All rights reserved.
//

#import <SVProgressHUD.h>
#import <PonyDebugger.h>

And,HeaderSearchPath of BuildSetting is below. 2015-04-13 21 18 21

According to following code,I got to see the PonyDebugger.

~/Documents/shotalertforswift on ⭠ master! ⌚ 21:24:32
$ ls Pods/Headers/Public/PonyDebugger                                                                                                                                                   system
NSArray+PDRuntimePropertyDescriptor.h         PDConsoleDomainController.h                   PDDynamicDebuggerDomain.h                     PDPageTypes.h
NSArray+PD_JSONObject.h                       PDConsoleTypes.h                              PDFileSystemDomain.h                          PDPrettyStringPrinter.h
NSData+PDDebugger.h                           PDContainerIndex.h                            PDFileSystemTypes.h                           PDProfilerDomain.h
NSDate+PDDebugger.h                           PDDOMDebuggerDomain.h                         PDIndexedDBDomain.h                           PDProfilerTypes.h
NSDate+PD_JSONObject.h                        PDDOMDomain.h                                 PDIndexedDBDomainController.h                 PDRuntimeDomain.h
NSDictionary+PDRuntimePropertyDescriptor.h    PDDOMDomainController.h                       PDIndexedDBTypes.h                            PDRuntimeDomainController.h
NSError+PD_JSONObject.h                       PDDOMStorageDomain.h                          PDInspectorDomain.h                           PDRuntimeTypes.h
NSManagedObject+PDRuntimePropertyDescriptor.h PDDOMStorageTypes.h                           PDInspectorDomainController.h                 PDTimelineDomain.h
NSObject+PDRuntimePropertyDescriptor.h        PDDOMTypes.h                                  PDMemoryDomain.h                              PDTimelineTypes.h
NSOrderedSet+PDRuntimePropertyDescriptor.h    PDDatabaseDomain.h                            PDMemoryTypes.h                               PDWebGLDomain.h
NSSet+PDRuntimePropertyDescriptor.h           PDDatabaseTypes.h                             PDNetworkDomain.h                             PDWebGLTypes.h
PDApplicationCacheDomain.h                    PDDebugger.h                                  PDNetworkDomainController.h                   PDWorkerDomain.h
PDApplicationCacheTypes.h                     PDDebuggerDomain.h                            PDNetworkTypes.h                              PonyDebugger.h
PDCSSDomain.h                                 PDDebuggerTypes.h                             PDObject.h
PDCSSTypes.h                                  PDDefinitions.h                               PDPageDomain.h
PDConsoleDomain.h                             PDDomainController.h                          PDPageDomainController.h

How come did not ponydebugger reference? Please help.

efirestone commented 9 years ago

Shot in the dark here, but have you tried importing <PonyDebugger/PonyDebugger.h> instead of <PonyDebugger.h>?

dfed commented 9 years ago

Yeah, it looks like the import is missing. Closing this. Please re-open if the import doesn't resolve the issue.

shiratsu commented 9 years ago

Thank you.I will try it.