Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CocoaHTTPServer2.3 Implicit declaration of function 'LOG_OBJC_MAYBE' is invalid in C99

I use the last version of pod 'CocoaHTTPServer', '~> 2.3' and xcode Version 8.1 beta (8T29o) and swift 3.0

When i install this pod i get this error on HTTPLogError (and other method of HTTPLoging.h).

/Volumes/app/Project_ios/Pods/CocoaHTTPServer/Extensions/WebDAV/DAVResponse.m:102:9: Implicit declaration of function 'LOG_OBJC_MAYBE' is invalid in C99
like image 220
Andrea Bozza Avatar asked Oct 17 '16 11:10

Andrea Bozza


1 Answers

I did the following steps to solve the problem:

Step 1: change #import "DDLog.h" to #import <CocoaLumberjack/CocoaLumberjack.h> in file HTTPLogging.h

Step 2: replace all LOG_OBJC_MAYBE with HTTP_LOG_OBJC_MAYBE and all LOG_C_MAYBE with HTTP_LOG_C_MAYBE in file HTTPLogging.h

Step 3: add the following macro in file HTTPLogging.h

#define HTTP_LOG_OBJC_MAYBE(async, lvl, flg, ctx, frmt, ...) \
do{ if(HTTP_LOG_ASYNC_ENABLED) LOG_MAYBE(async, lvl, flg, ctx, nil, sel_getName(_cmd), frmt, ##__VA_ARGS__); } while(0)

#define HTTP_LOG_C_MAYBE(async, lvl, flg, ctx, frmt, ...) \
do{ if(HTTP_LOG_ASYNC_ENABLED) LOG_MAYBE(async, lvl, flg, ctx, nil, __FUNCTION__, frmt, ##__VA_ARGS__); } while(0)

Hope my experience can give help.

like image 164
Zhou Jason Avatar answered Sep 30 '22 04:09

Zhou Jason