gdelataillade / alarm

A Flutter plugin to easily manage alarms on iOS and Android
https://pub.dev/packages/alarm
MIT License
132 stars 86 forks source link

iOS Setup - Type 'SwiftAlarmPlugin' has no member 'registerBackgroundTasks' #97

Closed victorshin12 closed 1 year ago

victorshin12 commented 1 year ago

Alarm plugin version 2.0.0

Describe the bug When following the steps of iOS Setup page, I get an error when I paste the following code into my App Delegate:

if #available(iOS 10.0, *) {
  UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
}
SwiftAlarmPlugin.registerBackgroundTasks()

To Reproduce Steps to reproduce the behavior:

  1. Setup alarm clock app
  2. Follow steps of INSTALL-IOS.md and paste the code into AppDelegate.swift

Expected behavior No errors.

Screenshots

Screenshot 2023-09-26 at 12 38 19 PM Screenshot 2023-09-26 at 12 38 40 PM Screenshot 2023-09-26 at 12 39 06 PM

Device info XCode 14.3.1

gdelataillade commented 1 year ago

Hi @victorshin12,

That's weird, registerBackgroundTasks is located in the SwiftAlarmPlugin class.

Try to run pod install --repo-update in your ios folder.

Let me know if it fixes the issue.

victorshin12 commented 1 year ago

Thanks for the advice.

The pod install didn't do much, but I found a workaround by copying and pasting the github file code of SwiftAlarmPlugin.swift into my project file's SwiftAlarmPlugin.swift.

Don't know what's causing the project file to not be updated when pods are installed, but might be case-by-case issue.