対処法: Swift 2.0 – Binary Operator “|” cannot be applied to two UIUserNotificationType operands

Swift 6での書き方

現在はUserNotificationsを使うよ。通知が必要になるタイミングでTaskやasync関数から呼び出し、戻り値とエラーを処理してね。ユーザーは許可を拒否したり、あとから設定を変更したりできるよ。Apple公式:通知の許可

以下は旧バージョン当時の記録

Swiftを久しぶりに再開してみて、Local Notificationを実装しようとして出た以下のエラー。

Swift 2.0 – Binary Operator “|” cannot be applied to two UIUserNotificationType operands

 

 

訂正前のLocal Notification

 

訂正後のLocal Notification

 

こんな感じで書き方が変わってるので注意。

参考: Swift 2.0 – Binary Operator “|” cannot be applied to two UIUserNotificationType operands

スポンサーリンク
スポンサーリンク
タイトルとURLをコピーしました