Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/115.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 收到UILocalnotification时无振动_Ios_Objective C_Uilocalnotification - Fatal编程技术网

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_振动);正确的?我插入它进行测试或希望它能工作。因为在发出通知时,没有振动。