1

我正在尝试在我的应用程序上将 CocoaLumberjack 实现为框架,但我遇到了一些问题。这是我在 AppDelegate.h 上的实现:

#import "AppDelegate.h"
#import <CocoaLumberjack/CocoaLumberjack.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [DDLog addLogger:[DDASLLogger sharedInstance]];
    [DDLog addLogger:[DDTTYLogger sharedInstance]];
    DDFileLogger *fileLogger = [[DDFileLogger alloc] init];
    fileLogger.maximumFileSize = 1024 * 1024;
    fileLogger.rollingFrequency = 60 * 60 * 24; // 24 hour rolling
    fileLogger.logFileManager.maximumNumberOfLogFiles = 7;
    [DDLog addLogger:fileLogger];
    DDLogWarn(@"blablabla");
    DDLogError(@"Broken sprocket detected!");
    DDLogVerbose(@"User selected file:%@ withSize:%u", @"temp/test/log.txt", 100000);
    return YES;
}

在应用程序中,委托没有问题。但在我的 ViewController 中:

- (void)viewDidLoad {
    [super viewDidLoad];
     DDLogError(@"something when wrong!!!"); // <-- implicit declaration of function is invalid in c99
}

函数的隐式声明在 c99 中无效 你们中的任何人都知道出了什么问题或解决此错误的任何方法吗?

我会非常感谢你的帮助。

4

1 回答 1

0

添加以下行:

#define LOG_LEVEL_DEF ddLogLevel
#import <CocoaLumberjack/CocoaLumberjack.h>

请参阅入门文档的访问和配置框架部分。

于 2017-04-11T10:08:28.020 回答