Cocoa Lumberjack Syntax Error

305 views
Skip to first unread message

Ryan Liao

unread,
Aug 25, 2012, 10:12:04 PM8/25/12
to cocoalu...@googlegroups.com
Hi,

I am new to xCode coding, so I have a few questions.

I am currently using the latest xCode to develope iPhone app.

To import the framework, do I import the entire folder or do I only have to drag certain files into the project folder?

And when I imported the DDFileLogger framework,I'm getting unexpected '@' in program errors in DDFileLogger.m:

- (NSString *)description 
{
return [@{@"filePath": self.filePath, 
@"fileName": self.fileName, 
@"fileAttributes": self.fileAttributes, 
@"creationDate": self.creationDate, 
@"modificationDate": self.modificationDate, 
@"fileSize": @(self.fileSize), 
@"age": @(self.age), 
@"isArchived": @(self.isArchived)} description]; 
}

Please provide possible solutions to fix this.

Thank You Very Much!,

-Ryan

mkloster

unread,
Aug 25, 2012, 10:47:15 PM8/25/12
to cocoalu...@googlegroups.com
Ryan,

I got that error when I compiled as well. My solution was to upgrade to the latest xCode and compiler (v4). 

The syntax is new to the latest version of Objective-C. The '@' is defining a NSDictionary literal in this case. The same symbol can be used to define NSNumber literals and NSArray literals too.

Is upgrading your xCode and compiler and option?

Michael

Ryan Liao

unread,
Aug 29, 2012, 12:04:55 AM8/29/12
to cocoalu...@googlegroups.com
Hi Michael,

Thank you very much for replying to and solving my problem!!!

I upgraded my xCode to 4.4.1 and it got rid of the @ syntax problem!!!.

However, when I am using the framework, it still gives me many errors.

I want to use DDFileLogger to save my logs to a file, but I am having trouble setting it up.

Can you please provide explanations on how to use DDFileLogger?

Thanks,

Ryan

--
You received this message because you are subscribed to the Google Groups "CocoaLumberjack" group.
To post to this group, send email to cocoalu...@googlegroups.com.
To unsubscribe from this group, send email to cocoalumberja...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/cocoalumberjack/-/xV1gROm1QvMJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

mkloster

unread,
Aug 29, 2012, 12:24:29 AM8/29/12
to cocoalu...@googlegroups.com
Have you found this document:

The Getting Started section shows an example of a file logger. 

If you give an example of the error. It will be easier to help.

Michael

Ryan Liao

unread,
Aug 29, 2012, 12:54:33 AM8/29/12
to cocoalu...@googlegroups.com
I have read the Getting Started Section and the section in regard of log file management.

However, I could not find any examples on setting up the directory path and writing to file.

-Ryan

To view this discussion on the web visit https://groups.google.com/d/msg/cocoalumberjack/-/rMtr8wxlr1YJ.

Michael Kloster

unread,
Aug 29, 2012, 1:17:17 AM8/29/12
to cocoalu...@googlegroups.com
By default, the files are stored under:

Library/Caches/Logs

I prefer to keep my logs under Documents. So, I've set up mine like this:

NSString* baseDocDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSString* logDir = [NSString stringWithFormat:@"%@/logs",baseDocDir];
DDLogFileManagerDefault* logFileManager = [[[DDLogFileManagerDefault alloc ]initWithLogsDirectory:logDir] autorelease];
DDFileLogger* fileLogger = [[[DDFileLogger alloc] initWithLogFileManager:logFileManager]autorelease];
//...other settings...
[DDLog addLogger:self.defaultFileLogger];

Its the DDLogFileManagerDefault where you can specify the log directory. Now, logs will be written under Documents/logs

Give that a try, and let me know how it goes.

Michael
Reply all
Reply to author
Forward
0 new messages