1

I'm trying to implement CocoaLumberjack on my app as framework but I'm having some issues. Here is my implementation on my 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;
}

In the app delegate has no issues. But in my ViewController:

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

implicit declaration of function is invalid in c99 Any of you knows what is wrong or any work around this error?

I'll really appreciate your help.

user2924482
  • 8,380
  • 23
  • 89
  • 173
  • what this means is that the compile can't find a definition for DDLogError. Did you include the cocoa lumberjack header in your viewcontroller.m file? – Byron Apr 08 '17 at 02:02
  • @Byron, I add this on the viewController #import and it resolved the C99 error but now I'm getting this error: "use of undeclared identifier ddloglevel" – user2924482 Apr 10 '17 at 17:02

1 Answers1

0

Add the following lines:

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

See the Access and configure the framework section of the Getting Started documentation.

DDP
  • 2,463
  • 1
  • 26
  • 28
  • for some reason it doesn't work for me. I fixed add this: #import #if DEBUG static const DDLogLevel ddLogLevel = DDLogLevelVerbose; #else static const DDLogLevel ddLogLevel = DDLogLevelWarning; #endif – user2924482 Apr 11 '17 at 18:32