Giter Site home page Giter Site logo

Comments (5)

100mango avatar 100mango commented on July 24, 2024

不是很明白你说的这个是什么问题。你可以参考一下SwiftTimer的源代码,按照SwiftTimer的代码模式来使用就好。

from zen.

baobao57 avatar baobao57 commented on July 24, 2024

我只是在使用的时候,scheduleRepeating这个方法有好多个不同的参数配置。
其中就包括
像这个图片一样
这里的DispatchWallTime 应该也可以用到timer里吧, 但是我使用他的时候,他却不会执行timer。
请问你对DispatchWallTime使用过么? ios10 swift3.0

from zen.

100mango avatar 100mango commented on July 24, 2024

我觉得有可能原因是你是在Playground上面运行的。Playground执行完一遍就结束进程了。你需要在Playground加上一句:PlaygroundPage.current.needsIndefiniteExecution = true

from zen.

baobao57 avatar baobao57 commented on July 24, 2024

原因我找到了。是因为我初始化timer的时候,没有初始化成一个全局变量,当方法执行过后,这个timer就被销毁了。也就不会调用定时器
DispatchTime & dispatchWallTime 使用并无区别,只不过根据网上的说法是一个是相对时间,一个代表的是绝对时间。 就是dispatchTime可能会在特殊的情况下被挂起,但是无论任何情况dispatchWallTime都不会被挂起。

from zen.

100mango avatar 100mango commented on July 24, 2024

嗯嗯。生命周期的问题。解决了就好。

from zen.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.