我是Jekyll的初学者,我看到有很多关于此问题的问题,但是给出的解决方案与我的问题不符,所以如果有人可以帮助我,请问?我已经有一段时间了。
这是我在运行static func configurePushCategories() {
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().requestAuthorization(options: [.alert,.badge,.sound]) { (granted:Bool, error:Error?) in
if error != nil {
print(error?.localizedDescription as Any)
}
if granted {
print("Permission granted")
} else {
print("Permission not granted")
}
}
// actions
let buy = UNNotificationAction(identifier: "buy", title: "Buy", options: [.foreground])
let play = UNNotificationAction(identifier: "play", title: "Play", options: [.foreground])
let close = UNNotificationAction(identifier: "close", title: "Close", options: [.foreground])
// let shopPromotionsCategory = UNNotificationCategory(identifier: "shop-promotions", actions: [buy,close], intentIdentifiers: ["buy","close"], options: [])
// let fixItPromotionsCategory = UNNotificationCategory(identifier: "fix-it-promotions", actions: [buy,close], intentIdentifiers: ["buy","close"], options: [])
// let cityFixItNewsCategory = UNNotificationCategory(identifier: "city-fix-it-news", actions: [play,close], intentIdentifiers: ["play","close"], options: [])
// let countryFixItNewsCategory = UNNotificationCategory(identifier: "country-fix-it-news", actions: [play,close], intentIdentifiers: ["play","close"], options: [])
let shopPromotionsCategory = UNNotificationCategory(identifier: "shop-promotions", actions: [buy,close], intentIdentifiers: [], options: [])
let fixItPromotionsCategory = UNNotificationCategory(identifier: "fix-it-promotions", actions: [buy,close], intentIdentifiers: [], options: [])
let cityFixItNewsCategory = UNNotificationCategory(identifier: "city-fix-it-news", actions: [play,close], intentIdentifiers: [], options: [])
let countryFixItNewsCategory = UNNotificationCategory(identifier: "country-fix-it-news", actions: [play,close], intentIdentifiers: [], options: [])
UNUserNotificationCenter.current().setNotificationCategories([shopPromotionsCategory,fixItPromotionsCategory, cityFixItNewsCategory, countryFixItNewsCategory])
} else {
// Fallback on earlier versions
}
}
之后收到的消息:
for index, row in df.iterrows():
df['Text']=df['Text'].str.replace('\n','')
df['Text']=df['Text'].str.replace('\'','')
df.Text = df.Text.str.replace(',','')
df.Text = df.Text.str.replace('[','')
df.Text = df.Text.str.replace(']','')
df.Text=df.Text.str.replace('\s+',' ', regex = True)
df.Text=df.Text.str.replace('Questions and Answers',' ')