1. Background does not execute
Load the library file first: audiotoolbox.framework
Introduction of header file: #import "audiotoolbox/audiotoolbox.h" (Warm tip: because it is called Objective-c Note the file name)
Opening method: Audioservicesplaysystemsound (Ksystemsoundid_vibrate);
You cannot modify the vibration parameters, each call generates a short 1-2-second vibration. On a platform that does not support vibration, the call does nothing, but it does not have an error-(void) Application: (UIApplication *) application didreceiveremotenotification: ( Nsdictionary *) UserInfo Fetchcompletionhandler: (void (^) (uibackgroundfetchresult)) Completionhandler { //IOS 7 Support Required NSLog (@ "received notification:%@", userInfo); [Apservicehandleremotenotification:userinfo]; Completionhandler (uibackgroundfetchresultnewdata); After receiving the notification continuous vibration audioservicesaddsystemsoundcompletion (ksystemsoundid_vibrate, NULL, NULL, Systemaudiocallback, NULL); Audioservicesplaysystemsound (ksystemsoundid_vibrate);} void Systemaudiocallback (Systemsoundid soundid, void* clientdata) { Audioservicesplaysystemsound (KSystemSoundID _vibrate);}
2. The front office is executed
Continuous vibration after receiving notification for (int i=0; i<10; i++) { [nsthread sleepfortimeinterval:0.7]; Audioservicesplaysystemsound (ksystemsoundid_vibrate);}
IOS Mobile (continuous) vibrate