为什么我的iPhone不振动?

Wal*_*zzi 1 objective-c iphone-vibrate vibration ios

当我选择UITableView中的单元格时,我尝试使用Vibration.

在我的didselectedRowAtIndexPath我已经把这个代码:

    #pragma mark - DidselectRow

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    //SPINNER
    [spinner startAnimating];


    //[self performSelector:@selector(pushDetailView:) withObject:tableView afterDelay:0.1];

    int *riga = indexPath.row;
    [NSThread detachNewThreadSelector:@selector(pushDetailView) toTarget:self withObject:riga];

    ////////////////////////////////////////////////////////////////////////////////
    //                          VIBRATION ALLERT                                  //
    ////////////////////////////////////////////////////////////////////////////////

    // Issue vibrate
    //AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
    AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
    NSLog(@"Vibra?");
    ////////////////////////////////////////////////////////////////////////////////
    //                          VIBRATION ALLERT  FIN                             //
    ////////////////////////////////////////////////////////////////////////////////



    NSLog(@"Seleziono l'immagine: %@", [photoTitles objectAtIndex:indexPath.row]);

    //creo un'istanza di DettaglioView
    DettaglioView *dettaglioImmagine = [[DettaglioView alloc] initWithNibName:@"DettaglioView" bundle:nil];



    //Inseirsco il titolo nella Navigation BAR della vista
    dettaglioImmagine.titoloSource = [photoTitles objectAtIndex:indexPath.row];

    dettaglioImmagine.imageCoverSource = [photoURLsLargeImage objectAtIndex:indexPath.row];
    NSLog(@"imageCoverSource: %@",  dettaglioImmagine.imageCoverSource);


    //passo alla vista del DettaglioView con l'animazione usando il pushViewController
    [self.navigationController pushViewController:dettaglioImmagine animated:YES];


    //pulisco lo style della cella selezionata togliendo il fondino blu
    [tableView deselectRowAtIndexPath:indexPath animated:YES];



}
Run Code Online (Sandbox Code Playgroud)

但是当我点击手机时,iPhone不会振动.为什么?有人可以帮帮我吗?

Ale*_*iks 5

检查您的iPhone声音设置.如果在"设置"中禁用了振动,则iPhone也不会振动,如果应用程序引起振动也是如此.