在我的应用程序中,我必须捕捉一个频率,然后显示视图控制器。要得到我使用的频率pitch detector。我得到的频率,但当我尝试运行应用程序,它应该加载视图控制器时崩溃。我后我写的代码:获取频率并显示视图控制器
- (void)frequencyChangedWithValue:(float)newFrequency {
frequencyRecived = newFrequency;
NSLog(@"%f", frequencyRecived);
if (frequencyRecived > 18000) {
[self.imageListening.layer removeAllAnimations];
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
GameViewController *controller = (GameViewController*)[storyBoard instantiateViewControllerWithIdentifier:@"game"];
[self stopListener];
[self presentViewController:controller animated:YES completion:nil];
}
}
它崩溃正是在[self presentViewController:controller animated:YES completion:nil];
行和Xcode中这样说:
bool _WebTryThreadLock(bool), 0x14e5de30: Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashing now...
1 0x366036fb WebThreadLock
2 0x30e1e6a3 <redacted>
3 0x30f46a69 <redacted>
4 0x31015171 <redacted>
5 0x31015111 <redacted>
6 0x31014e87 <redacted>
7 0x30e94a4f <redacted>
8 0x31015171 <redacted>
9 0x31014e87 <redacted>
10 0x30f70607 <redacted>
11 0x31015171 <redacted>
12 0x31015111 <redacted>
13 0x31014e87 <redacted>
14 0x30f6fdd9 <redacted>
15 0x30ec862b <redacted>
16 0x30d24bed <redacted>
17 0x30c0530d <redacted>
18 0x30c05289 <redacted>
19 0x30cae937 <redacted>
20 0x30ceb4b3 <redacted>
21 0x30ce9deb <redacted>
22 0x30ce8e55 <redacted>
23 0xcf783 -[ViewController frequencyChangedWithValue:]
24 0xd11f7 RenderFFTCallback(void*, unsigned long*, AudioTimeStamp const*, unsigned long, unsigned long, AudioBufferList*)
25 0x2dda569f <redacted>
26 0x2dd944eb <redacted>
27 0x2dd955d9 <redacted>
28 0x2dd8bdff <redacted>
29 0x2dcf9899 <redacted>
30 0x2dd68889 <redacted>
31 0x2dd94809 <redacted>
我使用的代码在另一个应用程序和它的伟大工程,什么是错在我的代码,为什么它向我显示这个问题?我希望你能帮助我
有相同的情况。此解决方案完美运作。 – cyan