I'm getting compiler warnings with AFNetworking, but shouldn't be. How do I fix it?

后端 未结 3 1349
栀梦
栀梦 2020-12-14 00:50

I\'m using the most excellent AFNetworking library in a project that I\'m currently upgrading to iOS 6. I\'m in the middle of the upgrade, whittling down the bu

3条回答
  •  眼角桃花
    2020-12-14 01:14

    This has already been answered, but still, if you're developing a command line tool potentially to be compiled for both OS X and iOS (not App Store for sure), you can add this:

    #ifdef __OBJC__
        #import 
        #import 
    
        #if TARGET_OS_IPHONE
            #import 
        #elif TARGET_OS_MAC
            #import 
        #endif
    
    #endif
    

    By evaluating the target you're compiling to, it will include the proper files.

提交回复
热议问题