Ios 收到UILocalnotification时无振动
我不明白。这是我的代码,我在其中配置我的Ios 收到UILocalnotification时无振动,ios,objective-c,uilocalnotification,Ios,Objective C,Uilocalnotification,我不明白。这是我的代码,我在其中配置我的LocalNotification并启动它。它工作正常,但没有振动。我想当我收到通知时应该会有震动 我尝试了AudioServicesPlayAlertSound(ksystemsSoundId_振动)/AudioServicesPlaySystemSound(ksystemsSoundId_振动),但没有成功 - (void)locationManager:(CLLocationManager *)manager didDetermineState:(C
LocalNotification
并启动它。它工作正常,但没有振动。我想当我收到通知时应该会有震动
我尝试了AudioServicesPlayAlertSound(ksystemsSoundId_振动)/AudioServicesPlaySystemSound(ksystemsSoundId_振动),但没有成功
- (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];
}
}
根据文档,它确实声明:请注意,在发送通知时,您不能以编程方式使设备振动,因为用户可以控制警报是否伴随振动。看,我想你指的是音频服务音频(kSystemSoundID_振动);正确的?我插入它进行测试或希望它能工作。因为在发出通知时,没有振动。