开发者

'No method found' compiler warning for a method inside a #define directive

I have a method DoSomething() defined in my AppDelegate.

This is the full implementation of my appDelegate:

#import "SampleAppAppDelegate.h"
#import <Foundation/Foundation.h>

#define DoSomething()\
NSConnection *conn = [NSConnection connectionWithRegisteredName:@"myConnection" host:nil];\
NSLog(@"Compiler seems to have found the class %@", [NSConnection class]);\


@implementation SampleAppAppDelegate

@synthesize window;

#pragma mark -
#pragma mark Application lifecycle

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    // Override point for customization after application launch.
    DoSom开发者_如何学JAVAething();
    [self.window makeKeyAndVisible];

    return YES;
}

- (void)dealloc {
    [window release];
    [super dealloc];
}

@end

Although the implementation is working fine as expected (the log is recognizing the class) the compiler is displaying a warning:

warning: no '+connectionWithRegisteredName:host:' method found

Any ideas how I can solve this issue? How can I modify the implementation to get rid of the warning?


Ah, you’re targeting iOS. NSConnection is not available in the public API for the iOS SDK.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜