문제

Does Anyone have any idea why this code produces this errors in OS 3.0 and not OS 2.2.1?

NSUInteger aCount = [serverBrowser.servers count];  

error: type of accessor does not match the type of property 'servers'

ServerBrowser.h is define below and serverBrowser is synthesized in .m above.

#import <Foundation/Foundation.h>

    @class ServerBrowserDelegate;

    @interface ServerBrowser : NSObject {
      NSMutableArray* servers;
      id<ServerBrowserDelegate> delegate;
    }

    @property(nonatomic,readonly) NSArray* servers;


    @end

Thanks in advance for the help. Much appreciated. Jordan

도움이 되었습니까?

해결책

It has to do with the fact that you provide the @property for the servers array as an NSArray*, but declare the backing instance variable as an NSMutableArray*. The OS 3.0 compiler may just come with stricter compiler settings than 2.2.1. Try converting to:

@property(nonatomic,readonly) NSMutableArray *servers;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top