[英]Exception while setting property in subclass of MKMapView
我遇到一個奇怪的錯誤。 在發布模式下安裝測試應用程序后,出現錯誤:
[SomeMapView setRotateEnabled:]: unrecognized selector sent to instance 0x1c58ac40
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SomeMapView setRotateEnabled:]: unrecognized selector sent to instance 0x1c58ac40'
Mapview已初始化,並在init方法中嘗試停用旋轉。 在調試模式下,它工作正常。
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
[self setRotateEnabled:FALSE];
[self initDelegate];
}
return self;
}
也許有人知道發生了什么事? 提前致謝。
這是iOS版本中的問題。 RotateEnabled僅在Suresh指出的iOS7中可用。 我不得不檢查屬性是否在那里(或檢查它是否具有iOS7),例如
if ([self respondsToSelector:NSSelectorFromString(elementName)])
{
[self setValue:elementInnerText forKey:elementName];
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.