2015-03-31 194 views
2

無效我需要500毫秒秒振動,我使用下面的代碼的功能「AudioServicesPlaySystemSoundWithVibration」隱式聲明是在C99

NSMutableDictionary* dict = [NSMutableDictionary dictionary]; 
NSMutableArray* arr = [NSMutableArray array ]; 

[arr addObject:[NSNumber numberWithBool:YES]]; //stop for 500ms 
[arr addObject:[NSNumber numberWithInt:500]]; 

[dict setObject:arr forKey:@"VibePattern"]; 
[dict setObject:[NSNumber numberWithInt:1] forKey:@"Intensity"]; 


AudioServicesPlaySystemSoundWithVibration(4095,nil,dict); 

AudioServicesPlaySystemSoundWithVibration完美的工作,但給的警告以及我不能夠釋放我的應用程序到應用商店。

我的AMD包括AudioTools框架在我的項目

請幫我

在此先感謝

+0

這是一個私有的API方法,你不能使用它。看看http://stackoverflow.com/questions/4724980/making-the-iphone-vibrate而不是 – luk2302 2015-03-31 11:34:14

+0

謝謝** luk2302 **'AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);''AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);'這2功能振動手機但我需要500毫秒的振動,這種方法給我超過500毫秒。我只需要捏一下振動。 – Bhavsar1311 2015-04-01 13:36:43

+0

我認爲隱藏私有c API是不可能的。 – kelin 2016-12-26 11:04:15

回答

0

嘗試使用FOUNDATION_EXTERN宏聲明函數:

FOUNDATION_EXTERN AudioServicesPlaySystemSoundWithVibration(unsigned long, objc_object*, NSDictionary*) 

但準備因私人API使用而被拒絕,特別是在美國App Store上。

相關問題