开发者

parameter of incompatible type (weird problem)

开发者 https://www.devze.com 2023-02-18 00:32 出处:网络
I downloaded Xcode 4 recently and I got this new warning that I didn\'t have before. The following code (in FTSocialNetworkingController class):

I downloaded Xcode 4 recently and I got this new warning that I didn't have before. The following code (in FTSocialNetworkingController class):

jsonConnection = [[FTJsonConnection alloc] initWithUrl:[NSURL URLWithString:urlString] 
                                                  delegate:self];

give this warning :

FTSocialNetworkingController.m: warning: Semantic Issue: Sending 'FTSocialNetworkingController *' to parame开发者_JS百科ter of incompatible type 'id<FTImageDownloaderDelegate>'

I know what the problem means: self should conform to the FTImageDownloaderDelegate protocol. What is weird about that is that the delegate parameter in the initWithUrl:delegate: method is of type id <FTJsonConnectionDelegate> and the method is declared like this in the FTJsonConnection class (.h)

- (id)initWithUrl:(NSURL *)anUrl delegate:(id <FTJsonConnectionDelegate>)delegate;

I don't know why it asks for the FTImageDownloaderDelegate since I'm not even using it in the FTSocialNetworkingController class.

I've just got the problem today and I don't know where it comes from. My other classes which use the initWithUrl:delegate: method don't have the problem.

So if someone has any idea of what this is about...


Try this:

jsonConnection = [[FTJsonConnection alloc] initWithUrl:[NSURL URLWithString:urlString] 
                                              delegate:(id)self];
0

精彩评论

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