私のアプリには、Trip
エンティティと対多の関係を持つエンティティがSpot
あり、旅行とそのスポット リストをバックグラウンド スレッドで読み込む必要があります。デバッグ版では正常に動作しますが、リリース版ではスポット リストが空です。少し調べてみたところ、コンパイラの最適化レベルを に設定しない限り、リリース バージョンでは動作しないことがわかりました-O0
。おそらくコンパイラのバグだと思います。
より高い最適化レベルで機能させるための提案はありますか、または最適化されていないアプリをリリースする必要がありますか? ありがとう!
コードは次のとおりです。
メインスレッド
[self performSelectorInBackground:@selector(calcRoute:) withObject:self.trip.objectID];
バックグラウンド スレッド
- (void)calcRoute:(NSManagedObjectID *)tripId
{
//get trip entity
CoreDataHelper * helper = nil; //responsible for init model, persistentStore and context
TripEntity * t = nil;
helper = [[CoreDataHelper alloc] initWithAnother:mainThreadHelper]; //only take the resource name and storeURL
t = (TripEntity *)[helper.context objectWithID:tripId]; //retrieve trip
if (0 == t.spotList.count) {
[self performSelectorOnMainThread:@selector(drawRouteFailed) withObject:nil waitUntilDone:FALSE];
return; //I got here!
}
//...
}