ios-Notice: Alarm about setting the alarm, click the app icon to enter the program does not play music issues (resolved)

Source: Internet
Author: User



See demo of the Day

The demo is detailed in the following description:

To set an alarm:

1. Notification time is not reached, click the app to enter directly, the notification time, the alarm clock does not sound (the alarm is not exited the program is also the case)

1.1 Solve this problem first through the notification time to call the proxy method, add an audio avfoundation, set to play;

1.2 Then another problem is that the alarm clock conflict is if the lock screen or exit the app after the notification, click on the notification to enter the program, (the system default notification of the music automatically stopped, but the proxy method set by the player will still start playing)

1.3 How to solve the above methods:

Set a global switch (that is, flag) and set flag to on if the program exits or is about to enter the foreground to keep the main program player playing

Another proxy method in the app applicationdidbecomeactive flag is set to off no, the execution time of this method is fixed, and after the program is activated,

However, it becomes the proxy method of notification (notification time to immediate execution), so if you swipe (lock screen) or click (Unlocked) to notify the app to immediately execute the notification agent method, and then go applicationdidbecomeactive method to set flag to no, because the incoming reception is set flag to Yes, the notification time has been to start the notification agent method, and the activation method has not been executed, at this time the alarm can ring.

This is the idea, for the convenience of everyone to see the effect, want to see the original code please leave the email to everyone.


This is the idea, for the convenience of everyone to see the effect, want to see the original code please leave the mailbox sent to everyone or add QQ.


ios-Notice: Alarm about setting the alarm, click the app icon to enter the program does not play music issues (resolved)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.