【问题标题】:UILocalNotification sound settings in iPad simulatoriPad模拟器中的UILocalNotification声音设置
【发布时间】:2013-03-31 07:01:01
【问题描述】:

我正在 iPad 模拟器上测试我的应用程序。但是通知声音播放有些问题。

当应用程序在前台运行而不是在后台运行时,将播放通知声音。它显示没有任何声音的横幅类型通知。我想知道 iPad 模拟器中的通知设置是否决定了这种情况。 iPhone 的设置应用程序有“通知”菜单,我们可以设置通知类型——无、横幅、警报和声音等。我无法弄清楚 iPad 设备设置应用程序,因为没有 iPad :(

iPhone 模拟器和 iPhone 设备正常工作。但不是 iPad 模拟器。

 -(void) registerNoti {
      localNotif.fireDate = noti.date;
      localNotif.timeZone = [NSTimeZone defaultTimeZone];


      //Payload
      localNotif.alertBody = [NSString stringWithFormat:@"%@",cell.textLabel.text];
      localNotif.alertAction = @"Run App";
      localNotif.soundName = @"sound.mp3";
      [[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
 }

有没有办法找出 iPad 模拟器通知声音的问题?或者我可以忽略这个问题,一切都好吗?

【问题讨论】:

    标签: ios notifications settings simulator audio


    【解决方案1】:

    尝试定义 mp3 文件的完整路径:

    localNotif.soundName = [[NSBundle mainBundle] pathForResource:@"sound" ofType:@"mp3"];

    也许对你有帮助。

    【讨论】:

      【解决方案2】:

      如果您没有 iPad(或有 iPad 的朋友可以为您测试),请不要为 iPad 发布此应用。永远不要依赖模拟器。您必须最终在设备上进行测试。你的问题就是一个例子:你现在通过猜测进行编程,这是在自找麻烦。你不知道你的应用真正做了什么(因为“真的”只能表示“在设备上”)。

      【讨论】:

        猜你喜欢
        • 2011-08-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-04-08
        相关资源
        最近更新 更多