UILocalNotification custom sound

前端 未结 3 1222
无人及你
无人及你 2021-01-12 07:25

I have been searching for a solution for hours.. with absolutely zero luck.

I set up a Local Notification:

UILocalNotification *notif = [[cls alloc]          


        
相关标签:
3条回答
  • 2021-01-12 07:42

    Try this:

    notif.soundName = [strSoundFileName copy];
    
    0 讨论(0)
  • 2021-01-12 07:48

    are you cleaning the old notifications with

    UIApplication* app = [UIApplication sharedApplication];
    NSArray*  oldNotifications = [app scheduledLocalNotifications];
    
    // Clear out the old notification before scheduling a new one.
    [app cancelAllLocalNotifications];
    

    ?

    0 讨论(0)
  • 2021-01-12 07:51

    ANSWER:

    Nothing wrong with the code..

    It's just that the stupid iPhone didn't cancel the old notifications that I made with the default sound -_-;

    When I cleaned the project, deleted the app from the phone AND REBOOTED the phone THEN it worked..

    Hope someone finds this helpful.

    0 讨论(0)
提交回复
热议问题