gpt4 book ai didi

ios - XMPPFramework 没有日志输出,通过 cocoapods 安装

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:19:42 27 4
gpt4 key购买 nike

如果我遗漏了什么,我深表歉意,但我没有收到任何日志输出。

我从 Cocoapods 安装了 XMPPFramework..

这些是我安装框架和设置 Xcode (V 5.0.2) 的步骤。

1.播客文件:

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

2.pod安装

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.控制台输出:

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

所以日志记录在 ViewController 中工作,但它似乎没有从 XMPPFramework 输出任何内容。

似乎 XMPPLogSend 没有触发。我在 sendOpeningNegotiation 中添加了一个断点,所以我期待输出

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

NSData *outgoingData = [s1 dataUsingEncoding:NSUTF8StringEncoding];

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

请注意,我非常是 objective-c/xcode 等方面的新手,所以如果有明显的遗漏,请告诉我。

有什么想法吗?

谢谢大家。

最佳答案

如前所述here on github您可以使用此

重新登录宏 XMPPLogSend
#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;
}

关于ios - XMPPFramework 没有日志输出,通过 cocoapods 安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20479172/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com