How I can open native alarm clock in iphone by using code?

前端 未结 3 2059
迷失自我
迷失自我 2021-01-05 15:55

I have to crate a sample app in which when I clicked a button that should open the native alarm clock so that user can use it for setting alarm?

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-05 16:53

    Two steps required.

    Add the URL to info.plist CFBundleURLSchemes

    
            
                CFBundleTypeRole
                Editor
                CFBundleURLSchemes
                
                    clock-alarm
                    clock-stopwatch
                
            
    
    

    Call sharedApplication's openURL

    [[UIApplication sharedApplication] 
      openURL:[NSURL URLWithString:@"clock-alarm:"]];
    ];
    

提交回复
热议问题