如何在特定日期前2天触发用户通知

时间:2017-08-22 02:45:41

标签: ios iphone swift swift3 usernotifications

如何在特定日期前2天触发用户通知

我之前曾尝试过UserNotification,但我知道我的时间间隔是基于时间间隔,但我不知道如何在日期触发此通知基础..有人可以帮助我...谢谢.. :))

1 个答案:

答案 0 :(得分:1)

我想出了感谢帮助。 El Tomato

@Scope
@Retention(AnnotationRetention.RUNTIME)
annotation class ActivityScope

@Module
abstract class ActivitiesBuilder {

    @ActivityScope
    @ContributesAndroidInjector(modules = arrayOf(HomepageModule::class, FacebookModule::class))
    abstract fun providesHomepageViewImpl(): HomepageViewImpl

}

@Module
abstract class AppModule {

    @Provides
    @Singleton
    fun provides (application: Application) : Context = application

}

@Singleton
@Component(
        modules = arrayOf(
                AndroidInjectionModule::class,
                ActivitiesBuilder::class,
                AppModule::class
        )
)
interface AppComponent : AndroidInjector<App> {

    @Component.Builder
    abstract class Builder : AndroidInjector.Builder<App>()

}

class App : DaggerApplication() {

    override fun onCreate() {
        super.onCreate()
        Timber.plant(Timber.DebugTree())
    }

    override fun applicationInjector(): AndroidInjector<out DaggerApplication> = DaggerAppComponent.builder().create(this)
}