我尝试将UISearchbar的条形颜色设置为一种颜色,将tintColor(光标和取消按钮)设置为另一种颜色,代码如下:
searchbar.barTintColor = color1;
searchbar.tintColor = color2;
Run Code Online (Sandbox Code Playgroud)
barTintColor正确应用.
问题是:取消按钮的文本不可见,但如果在故事板中尝试相同(将batTintColor和tintColor应用于UISearchbar),一切都按预期工作.
我正在尝试使用新的UNNotificationContentExtension来显示本地通知的自定义用户界面,但只显示默认通知警报.
我使用Xcode模板创建了扩展,并UNNotificationExtensionCategory在Info.plist中指定了该扩展.

在此之后,我注册了通知和设置UNNotificationCategory在application(_:didFinishLaunchingWithOptions:)
let center = UNUserNotificationCenter.current()
center.requestAuthorization([.alert, .sound]) { (granted, error) in
// Enable or disable features based on authorization.
}
let action = UNNotificationAction(identifier: "Delete", title: "Delete", options: [])
let category = UNNotificationCategory(identifier: "notify-test", actions: [action], minimalActions: [], intentIdentifiers: [], options: [])
UNUserNotificationCenter.current().setNotificationCategories([category])
Run Code Online (Sandbox Code Playgroud)
我安排通知在应用程序使用此代码进入后台后五秒触发:
let content = UNMutableNotificationContent()
content.title = NSString.localizedUserNotificationString(forKey: "Hello!", arguments: nil)
content.body = NSString.localizedUserNotificationString(forKey: "Hello_message_body", arguments: nil)
content.sound = UNNotificationSound.default()
content.categoryIdentifier = "notify-test"
let trigger = UNTimeIntervalNotificationTrigger.init(timeInterval: 5, repeats: false) …Run Code Online (Sandbox Code Playgroud) 我正在使用Apple实施Sign in,并注意到返回的email和fullName属性ASAuthorizationAppleIDCredential仅在此Apple ID的第一个Sign-In上填写。在所有后续登录中,这些属性均为零。
这是iOS 13上的错误还是预期的行为?
这是我用来启动请求的代码:
@available(iOS 13.0, *)
dynamic private func signInWithAppleClicked() {
let request = ASAuthorizationAppleIDProvider().createRequest()
request.requestedScopes = [.fullName, .email]
let controller = ASAuthorizationController(authorizationRequests: [request])
controller.delegate = self
controller.presentationContextProvider = self
controller.performRequests()
}
Run Code Online (Sandbox Code Playgroud)
我正在此委托方法中收到证书:
public func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization) {
guard let credential = authorization.credential as? ASAuthorizationAppleIDCredential else { return }
let userIdentifier = credential.user
let token = credential.identityToken
let authCode = credential.authorizationCode
let realUserStatus = credential.realUserStatus
let mail = …Run Code Online (Sandbox Code Playgroud) bartintcolor ×1
ios ×1
ios10 ×1
ios13 ×1
ios7 ×1
swift ×1
tintcolor ×1
uikit ×1
uisearchbar ×1
xcode11 ×1