我不明白。这是我配置我的LocalNotification
并解雇它的代码。它工作正常,但没有振动。我认为收到通知时应该有振动吗?
我试过AudioServicesPlayAlertSound(kSystemSoundID_Vibrate)/ AudioServicesPlaySystemSound(kSystemSoundID_Vibrate),但没有运气。
- (void)locationManager:(CLLocationManager *)manager didDetermineState:(CLRegionState)state forRegion:(CLRegion *)region
{
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.soundName = UILocalNotificationDefaultSoundName;
if(state == CLRegionStateInside)
{
notification.alertBody = @"Bla Bla";
wasWelcomeBefore = TRUE;
}
else if(state == CLRegionStateOutside)
{
notification.alertBody = @"Bla";
}
else
{
NSLog(@"locationManager didDetermineState OTHER for %@", region.identifier);
return;
}
if ([[UIApplication sharedApplication] applicationState] != UIApplicationStateActive){
if (!isNotifiForFirstBeacon && wasWelcomeBefore) {
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
NSDictionary *dataDict = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:isNotifiForFirstBeacon] forKey:@"isFirstBeacon"];
isNotifiForFirstBeacon = TRUE;
notification.userInfo = dataDict;
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];
}
}