当前位置: 动力学知识库 > 问答 > 编程问答 >

objective c - Error when defining NSString global constants

问题描述:

Possible Duplicate:

Interface type cannot be statically allocated?

Here is my code just like others:

TZNotifications.h

extern NSString *const TZNotificationKeywordAuthentication;

TZNotifications.m

NSString *const TZNotificationKeywordAuthentication = @"NOTIFICATION_KEYWORD_AUTHENTICATION";

But I get two errors with the code like this:

网友答案:

Replace 'const' and type declaration:

TZNotifications.h

extern const NSString *TZNotificationKeywordAuthentication;

TZNotifications.m

const NSString *TZNotificationKeywordAuthentication = @"NOTIFICATION_KEYWORD_AUTHENTICATION";
网友答案:

Thank you guys. Turns out I had stupidly add a nonsense string at the end of one of my header files causing this weird error. Sorry about that...

分享给朋友:
您可能感兴趣的文章:
随机阅读: