我需要在远程通知中显示超链接以及标题和正文。我做过这样的事情:
@IBAction func openPDFButtonPressed(_ sender: Any) {
self.scheduleNotification()
}
func scheduleNotification() {
let center = UNUserNotificationCenter.current()
let content = UNMutableNotificationContent()
content.title = "Download The Receipt"
content.body = "Kindly Download your purchase bill"
content.categoryIdentifier = "PDF"
content.userInfo = ["customData": "http://www.pdf995.com/samples/pdf.pdf"]
content.sound = UNNotificationSound.default
var dateComponents = DateComponents()
dateComponents.hour = 10
dateComponents.minute = 30
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false)
let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger)
center.add(request)
}
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping …
Run Code Online (Sandbox Code Playgroud) 我在我的项目中添加了一个自定义框架,但是当我运行该项目时,屏幕变黑并出现以下错误
日志:
"unable to determine interface type without an established connection"
&" unable to determine fallback status without a connection"
和不适用于我的自定义imegEdgeInsets
课程。我通过笔尖设置插图titleEdgeInsets
UIButton
自定义UIButton
类代码
class FilledButton: kButton {
private var bgColor = AppTonalPalette.color(.primary)
private var bgColorPressed = AppTonalPalette.color(.primary).withAlphaComponent(0.88)
private var foregroundColor = AppTonalPalette.color(.onPrimary)
private var bgColorDisabled = UIColor.init("#1F1F1F", alpha: 0.12)
private var foregroundColorDisabled = AppTonalPalette.color(.onSurface)
override func layoutSubviews() {
super.layoutSubviews()
updateViews()
}
func updateViews() {
tintColor = isEnabled ? foregroundColor : foregroundColorDisabled
setTitleColor(isEnabled ? foregroundColor : foregroundColorDisabled, for: .normal)
setTitleColor(isEnabled ? foregroundColor : foregroundColorDisabled, for: .highlighted)
backgroundColor = isEnabled ? (isHighlighted ? bgColorPressed : bgColor) …
Run Code Online (Sandbox Code Playgroud) 我想从日期选择器打印时间,但是使用AM/PM.我可以打印时间,但它从不打印AM/PM.我怎样才能做到这一点?
我的其他库不允许我设置-ObjC或all_load标志.所以我需要使用-force_load链接我的库.
我的项目下有"GoogleOpenSource.framework"和"GooglePlus.framework",所以如何正确地将这些映射到工作中.
我设置了这样的路径:
-force_load $(PROJECT_DIR)/Project_name/GooglePlus.framework/Versions/A/Headers/GooglePlus.h
-force_load $(PROJECT_DIR)/Project_name/GoogleOpenSource.framework/Versions/A/Headers/GoogleOpenSource.h
Run Code Online (Sandbox Code Playgroud)
在其他链接器标志下,但它不起作用.
谁能告诉我这里做错了什么?
我想从我的 iOS 应用程序打开 WIFI 设置部分,我的代码在 Swift 3 和 iOS 9.2 之前运行良好
if let settingsURL = URL(string: AppSettingsWifiUrl) {
UIApplication.shared.openURL(settingsURL)
}
Run Code Online (Sandbox Code Playgroud)
但是更新后它不适用于 Xcode 8 + Swift 3 + iOS 10,有人可以帮忙吗?