アプリ内のすべての .aif ファイル パスを保持する配列があります。この配列は、mainBundle とリソースを使用して見つけました。
この配列は、実際に使用される場所に到達するために、2 つのビュー コントローラーを介して渡される必要があります。問題は、クラッシュするか、完全に間違ったものをログに記録することです。デバッグすると、クラッシュ時に EXC_BAD_ACCESS のメモが表示されますが、通常どおり実行するとクラッシュするだけでは表示されません。
これが機能する場所です。
- (void)buildDrumTrigger {
defaultSounds = [[NSArray alloc] initWithObjects: @"kick_3", @"aif", @"snare_1", @"aif", @"HiHat_1", @"aif", @"ride_1", @"aif", @"crash_1", @"aif", @"crash_2", @"aif", @"crash_3", @"aif", @"wave_1", @"aif", nil];
self.DrumObject = [[DrumTrigger alloc] initWithSounds:defaultSounds:5:volumeBox];
[defaultSounds release];
NSLog(@"Possible Sounds: %@", DrumObject.possDrumSounds);
}
これは、fileName.aif で終わるパスの長いリストを返します。あなたはアイデアを得る。
でも...
// Change the current view to the options window.
- (IBAction)goToOptionsView {
NSLog(@"Loading options menu");
NSLog(@"DrumObject.drumSounds: %@", DrumObject.drumSounds);
NSLog(@"DrumObject.possDrumSounds: %@", DrumObject.possDrumSounds);
optionsViewController.soundBox2 = DrumObject.drumSounds;
optionsViewController.possDrumSounds = DrumObject.possDrumSounds;
[self presentModalViewController:optionsViewController animated:YES];
}
そのスニペットはクラッシュを引き起こします。possDrumSounds を扱う部分をコメントアウトすれば問題なく動作します。そうしないと、クラッシュするか、配列が変更されて、どこから来たのかわからない UIViewControllers のようなランダムなオブジェクトが含まれるようになります。
すべての助けに感謝します、ありがとう!