我在使用 iOS 7 SDK 的 Xcode 5 中收到警告
Auto property synthesis will not synthesize property declared in a protocol
我在使用 iOS 6.1 SDK 的 Xcode 4 中没有收到此警告。有什么想法吗?
这是我的代码:
列表.h
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
#import <MapKit/MapKit.h>
@interface List : UIViewController <UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate, CLLocationManagerDelegate, MKMapViewDelegate, MKAnnotation>
{
IBOutlet UITableView *tableView;
IBOutlet UISearchBar *searchBar;
}
@property (nonatomic, strong) NSArray *annotations;
@end
列表.m
#import "List.h"
#import "RSFM.h"
#import "AnnotationDetailView.h"
#import "DTCustomColoredAccessory.h"
@interface List ()
@end
@implementation List
{
NSMutableArray *title;
NSMutableArray *subtitle;
NSMutableArray *displayItems;
NSMutableDictionary *marketDictionary;
NSMutableArray *farmMarkets;
NSArray *keys;
NSMutableArray *objects;
}
我在线上收到警告:
@implementation List
最佳答案
您应该收到某种警告,因为 MKAnnotation
协议(protocol)包含许多属性,并且协议(protocol)中定义的属性从未支持自动合成。
要么从您声称支持的列表中删除该协议(protocol),要么实现适当的属性/访问器方法来履行规定的职责。
关于ios - Xcode 5 iOS 7 中的自动属性综合警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18835799/