我正在尝试在我的应用程序上将 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
}
我会非常感谢你的帮助。