开发者

IPhone SDK - Vibration triggered by Thread

开发者 https://www.devze.com 2022-12-28 16:51 出处:网络
I\'m currently working on an IPhone App that should make the phone vibrate if a special event occurs.

I'm currently working on an IPhone App that should make the phone vibrate if a special event occurs.

The checks to trigger the alert is done in a thread.

Unfortunately the phone won't vibrate if I call

 AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);开发者_运维问答

from inside the thread. (It works fine if I call this in my "viewDidAppear" method).

I even tried to do a callback from inside the thead like this:

 inside Thread:
 [self performSelectorOnMainThread:@selector(doAlarm) 
                                               withObject:nil 
                                            waitUntilDone:true];    

 -(void)doAlarm {
   AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);            
 }

which has the same result: No vibration on the phone.

How do I make the phone vibrate from inside a thread ??

Thanks in advance


Got it !

There were a Microphone Listener active which caused the problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消