我得到了我的應用程序工作回來,但完全和意外刪除它後,我試圖從一個方塊創建它。不幸的是我重寫的程序有點怪異;有沒有人看到或知道可能的錯誤來源?另外,我的if語句正在發揮作用。數組中的對象不被識別爲具有「方法」
-(void)loadAnnotations
{
CLLocationCoordinate2D workingCoordinate;
iProspectLiteAppDelegate *appDelegate = (iProspectLiteAppDelegate *)[[UIApplication sharedApplication] delegate];
NSMutableArray *mines =[[NSMutableArray alloc] initWithArray:(NSMutableArray *) appDelegate.mines];
BOOL gold = [[NSUserDefaults standardUserDefaults] boolForKey:@"goldControl"];
BOOL silver = [[NSUserDefaults standardUserDefaults] boolForKey:@"silverControl"];
BOOL copper = [[NSUserDefaults standardUserDefaults] boolForKey:@"copperControl"];
for(id mine in mines)
{
NSLog(@"in the loop");
workingCoordinate.latitude = [[mine latitudeInitial] doubleValue];
workingCoordinate.longitude = [[mine longitudeInitial] doubleValue];
iProspectLiteAnnotation *tempMine = [[iProspectLiteAnnotation alloc] initWithCoordinate:workingCoordinate];
[tempMine setTite:[mine mineName]];
if ([[mine commodity] isEqualToString:@"Gold"] && [gold == YES])
{
[tempMine setAnnotationType:iProspectLiteAnnotationTypeGold];
[mapView addAnnotation:tempMine];
}
if([[mine commodity] isEqualToString:@"Silver"] && [silver == YES])
{
[tempMine setAnnotationType:iProspectLiteAnnotationTypeSilver];
}
if([[mine commodity] isEqualToString:@"Copper"] && [copper == YES])
{
[tempMine setAnnotationType:iProspectLiteAnnotationTypeCopper];
}
}
[mines dealloc];
}
其中workingCoordinate.latitude = [[礦latitudeInitial]的doubleValue],以及經度,和[礦mineName],它說: 「否 '-latitudeInitiallongitudeInitial' 方法找到」 或mineName/LongitudeInitial。 也,它抱怨:之前]在所有的if語句行。我沒有看到任何錯誤,是嗎?
AGH !!!! **從不**自己調用'dealloc'!始終使用('auto')'release'! – 2010-06-11 05:56:05
我該怎麼做? – 2010-06-11 06:13:38
'[mines release];' – JeremyP 2010-06-11 07:53:13