4

I need 500ms seconds vibration for that i am using below code

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 working perfectly but give warning as well as i am not able to release my application to app store.

I amd include AudioTools framework in my project

Please help me

Thanks in advance

Bhavsar1311
  • 723
  • 6
  • 8
  • It is a private API method, you are not allowed to use it. Take a look at http://stackoverflow.com/questions/4724980/making-the-iphone-vibrate instead – luk2302 Mar 31 '15 at 11:34
  • Thanks **luk2302** `AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);` `AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);` this 2 function vibrate phone but i need 500ms vibration and this method give me more than 500ms. I need just pinch of vibration. – Bhavsar1311 Apr 01 '15 at 13:36
  • It's impossible to hide private c API, I think. – kelin Dec 26 '16 at 11:04

1 Answers1

1

Try to declare the function using FOUNDATION_EXTERN macro:

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

But be ready to get rejected for private API usage, especially on US App Store.

kelin
  • 11,323
  • 6
  • 67
  • 104