Module 'CocoaLumberjack' not found. in Objective-C project
Hello,
I have tried to configure PaperTrail for an iOS app but I did not manage. I used the guide on this page: http://help.papertrailapp.com/kb/configuration/configuring-centralized-logging-from-ios-or-os-x-apps/ My app uses CocoaPods and Objective-C so I did the following: 1- added to my Podfile "pod 'PaperTrailLumberjack'" 2- ran "pod install" 3- Started Xcode and pressed Build But build fails and I get the following error message: "Module 'CocoaLumberjack' not found. So I tried adding "pod ‘CocoaLumberjack'" to my Podfile and ran "pod install" again. Still I get the same build error message.
Someone at PaperTrail Support suggested that I use these new installation instructions instead: https://bitbucket.org/rmonkey/papertraillumberjack/ But I got the same error message when building the project anyway.
Can anyone help me please?
Thank you,
Alexandre
Comments (14)
-
reporter -
reporter - attached Podfile
-
Hi Alexandre,
Could you uncomment the use_frameworks! line in your Podfile and try re-installing the pod (you might also have to delete the pods directory and derived data in Xcode)? That line is needed as we are importing CocoaLumberjack as a module in PaperTrailLumberjack. Thanks
George
-
I'm trying to do the same, but without much luck; adding use_frameworks! didn't help.
The installation instructions at https://bitbucket.org/rmonkey/papertraillumberjack/ seems to be slightly off, as instead of
#import <PaperTrailLumberjack/RMPaperTrailLumberjack.h>
I could only do
#import <PaperTrailLumberjack/NSString+RMPaperTrailLumberjack.h>
The project won't build anyhow; the error message is "module 'CocoaLumberjack' not found" from RMPaperTrailLogger. Could you please re-check the installation instructions for Objective-C projects?
-
Hi Zoltán,
My apologies. I have updated the instructions. You need to include PaperTrailLumberjack.h instead of RMPaperTrailLumberjack.h.
I am not sure as to why you are still getting the module error. Would you be able to upload a barebones project showing the issue on bitbucket/github. I could then try to check it out and reproduce.
For my tests I am using Xcode 7.3.1 on OS X 10.11.5 - on which it seems to build fine.
Thanks
George
-
OK, so now I tried to reproduce with a new sample project and couldn't reproduce. I can think about two possibilities here:
- that there might be a conflict between the current dependencies we're trying to apply
- there's some project-level configuration which messes this up.
Do you have any ideas on where to look?
-
Hmm. Could you search for modules on your project's build settings? There should be one called "Enable Modules (C and Objective C)" under "Apple LLVM 7.1 - Language - Modules". If this is set to "No", you could try setting it to "Yes". Hope this helps..
-
That’s already on “Yes”; I will check the rest of the build settings to see if they make any difference.
-
Do let me know if you find anything. Only other things I can think of at the moment are "Link Frameworks automatically" being set to Yes in the same section. And, if you haven't already, you could also try deleting your project's Derived Data in Xcode. If I think of anything else, I'll put in a comment. Good luck :)
-
reporter Hi George,
I did manage to fix the issue and build the project successfully. However the following lines found at https://bitbucket.org/rmonkey/papertraillumberjack are for Swift language:
RMPaperTrailLogger *paperTrailLogger = [RMPaperTrailLogger sharedInstance]; paperTrailLogger.host = @"destination.papertrailapp.com"; //Your host here paperTrailLogger.port = 9999; //Your port number here [DDLog addLogger:paperTrailLogger]; DDLogVerbose(@"Hi PaperTrailApp.com");
Do you know what is the Objective-C equivalent for:
DDLogVerbose(@"Hi PaperTrailApp.com");
Thank you
-
Hi Alexandre,
Great that you have been able to build the project. You should be able to call DDLogVerbose/Info etc on Objective-C as well. Just make sure you have set the log level in the file you are calling it, to the level you want
#import "RMPaperTrailLogger.h" const int ddLogLevel = DDLogLevelVerbose;
There are a few example app's bundled in the repo (PaperTrailLumberjackiOSExample uses Objective-C). You could look at them for reference as well :)
Thanks
George
-
reporter Thank you George! It all works fine now.
I was wondering, is there a way to discard source code location from the logs? I have defined a global function to log to PaperTrail and the source code location at the start of every log is "AppDelegate@void ICULog(NSString *__strong)21]" which is pretty useless. I would rather save on the line length.
Thank you,
Alexandre
-
Hi Alexandre,
Glad you were able to get things to work. I haven't tried this out, but, in theory I think you can create your own custom log formatter (that formats the message the way you want). When you init your app, before your first logging message, set your custom formatter on the logger
logger.logFormatter = MyCustomFormatter
or
[[RMPaperTrailLogger sharedInstance] setLogFormatter:MyCustomFormatter]
However, please be aware that PaperTrailApp expects your messages to be in the syslog format (at least it did, when I first wrote this). Syslog format expects a few components to be present (you can dummy it up I guess), and, you might want to look at RMSyslogFormatter.m for a reference implementation. Hope this helps
George
-
- changed status to closed
Updated instructions
- Log in to comment