Vibrate for a long time?

2019-07-04 05:12发布

I want to make an app where while the user is pushing down a button the phone vibrates until the user releases the button.

Ive searched around and I haven't found a way to make it a long vibrate, except for a very old tutorial from 2009 which seems to be outdated.

3条回答
The star\"
2楼-- · 2019-07-04 05:26

It's not allowed by Apple to use the vibration as you want to:

Vibration. It is not permitted to use continuous vibration in your apps – short bursts as warnings is all that is allowed. Don’t bother trying to set up a timer to keep the vibration going, it will cause your app to be rejected.

It's not the method, but the result, that's not permitted.

Source: http://10base-t.com/unofficial-appstore-rejection-criteria/

查看更多
Lonely孤独者°
3楼-- · 2019-07-04 05:45

Look on these options,

1) AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
2) AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

also
Making the iPhone vibrate

And, you need to import AudioToolBox framework,

 #import <AudioToolbox/AudioServices.h>
查看更多
家丑人穷心不美
4楼-- · 2019-07-04 05:45
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

repeat this line in between you start-stop vibrate. don't forgot to add and import

#import <AudioToolbox/AudioToolbox.h> 

framework to your project.

查看更多
登录 后发表回答