سؤال

Apologies if I'm missing something on my part, but I am not receiving any logging output.

I installed XMPPFramework from Cocoapods..

These are the steps I took to install the framework and setup Xcode (V 5.0.2).

1.Podfile:

platform :ios, '7.0'
pod 'XMPPFramework', '~> 3.6.3'

2.pod Install

Output:

Analyzing dependencies
Downloading dependencies
Installing CocoaAsyncSocket (7.3.2)
Installing CocoaLumberjack (1.6.5.1)
Installing XMPPFramework (3.6.3)
Generating Pods project
Integrating client project

[!] From now on use `XMPPFramworkTemplate.xcworkspace`.
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.

3.AppDelegate.h

#import <DDLog.h>
#import <DDTTYLogger.h>
#import <DDASLLogger.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        // Override point for customization after application launch.

        [DDLog addLogger:[DDASLLogger sharedInstance]];
        [DDLog addLogger:[DDTTYLogger sharedInstance]];
          return YES;
    }

4.ViewController.m

#import <XMPPFramework.h>
#import <DDLog.h>
#import <DDTTYLogger.h>
#import <DDASLLogger.h>

static const int ddLogLevel = LOG_LEVEL_VERBOSE;

@interface ViewController ()
@property (strong, nonatomic) XMPPStream *xmppStream;
@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    //This works....
    DDLogVerbose(@"%@: %@", THIS_FILE, THIS_METHOD);

    //Testing
    [[self xmppStream] setMyJID:[ XMPPJID jidWithString:@"hidden@hidden.com"]];

    //Testing
    NSError *error = nil;
    [[self xmppStream] connectWithTimeout:XMPPStreamTimeoutNone error:&error];
}

...

5.Console output:

2013-12-07 12:54:46:449 XMPPFramworkTemplate[43458:70b] ViewController: viewDidLoad

So the logging is working within the ViewController, but it doesn't seem to output anything from the XMPPFramework.

It seems like the XMPPLogSend isn't firing. I added a breakpoint to sendOpeningNegotiation, so I was expecting an output of

NSString *s1 = @"<?xml version='1.0'?>";

NSData *outgoingData = [s1 dataUsingEncoding:NSUTF8StringEncoding];

XMPPLogSend(@"SEND: %@", s1);
numberOfBytesSent += [outgoingData length];
.....

Just as a caveat I am very new to objective-c / xcode etc so if there is something obvious I am missing, please let me know.

Any ideas?

Thanks all.

هل كانت مفيدة؟

المحلول

As mentioned here on github you can get logging back on for the macro XMPPLogSend by using this

#if DEBUG
    const int ddLogLevel = (LOG_LEVEL_VERBOSE | XMPP_LOG_FLAG_SEND);
#else
    const int ddLogLevel = LOG_LEVEL_INFO;
#endif

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    [DDLog addLogger:[DDTTYLogger sharedInstance] withLogLevel:ddLogLevel];

    return YES;
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top