Xcode “AppDelegate *const __strong' to parameter of incompatible type” error

前端 未结 1 1892
半阙折子戏
半阙折子戏 2021-02-10 17:09

When I declare appDelegate interface as follows in order to set NSXMLParserDelegate, I receive some warnings from other views that are using [[UIApplic

相关标签:
1条回答
  • 2021-02-10 17:51

    You really should not be making your AppDelegate publicly exposing interfaces. It creates very tight coupling between all your code. If other code (outside your AppDelegate) is needing an NSXMLParserDelegate you should make a different class for it.

    It looks like your AppDelegate is needing to be a delegate for its own purposes. You can "privately" implement the interface by making a class extension in your AppDelegate.m file.

    @interface AppDelegate() <NSXMLParserDelegate>
    @end
    

    Doing the above will remove the warning you received here:

    [xmlParser setDelegate:self];
    
    0 讨论(0)
提交回复
热议问题