簡體   English   中英

WatchOS:在鎖定屏幕上觀看時如何播放聲音?

[英]WatchOS: how can i play sound when watch going on lock screen?

我正在開發Apple Watch應用程序。 我的應用程序像每秒一樣工作,它在手表應用程序上發出聲音和振動通知。

否則,如何在15秒后停止手表鎖定屏幕?

我的代碼如下。

- (void)willActivate {

    [super willActivate];
    soundAlert = [NSTimer scheduledTimerWithTimeInterval:1.2f target:self selector:@selector(SoundAlertNotification) userInfo:nil repeats:YES];
}

- (void)SoundAlertNotification
{
    if (!isRechableFlag) {
        [self playsound];
    }

}

#pragma mark - Play Sound Methods -

- (void) playsound
{
    [[WKInterfaceDevice currentDevice] playHaptic:WKHapticTypeRetry];
}

但是,當手表要鎖定15個secode的屏幕時,我的聲音方法會停止調用,而效果很好。

我究竟做錯了什么?

這是用戶首選項設置, https://www.imore.com/how-keep-your-apple-watch-screen-longer

否則,您必須將應用程序設置為健身應用程序,以防止屏幕進入休眠狀態,但如果它實際上不是健身應用程序,則當您嘗試發布到應用程序商店時,它將被拒絕。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM