Hey there,
I'm currently walking through Apple's official SwiftUI tutorial at https://developer.apple.com/tutorials/swiftui/building-lists-and-navigation.
In Section 8, you can show multiple devices in the canvas preview using ForEach for example. Unfortunately, my canvas always shows the first devices instead of all. In my case, "iPhone XS Max" is not showing.
Does anyone know how to fix this? And where do I find the names of all other device types to add them to the device collection?
Thanks in advance!
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I'm trying to fetch update news from rss feed every hour.
Unfortunately, I sometimes get the following error:
simplexml_load_file(https://developer.apple.com/news/releases/rss/releases.rss): failed to open stream: HTTP request failed! HTTP/1.0 401 Unauthorized
I do not need to login to access that feed directly in my browser. But for some reason, my server runs into some problems with this.
Anyone has an idea how to fix this?
Thank you
Hello everyone, I need some help.
I have absolutely no clue why my notifications are not working.
My AppDelegate looks like this:
import UIKit
import UserNotifications
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
/// The base UIWindow
var window: UIWindow?
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
let token = deviceToken.map { String(format: "%02.2hhx", $0) }.joined()
print("token: \(token)")
}
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
print("Failed to register for remote notifications with error: \(error))")
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
UNUserNotificationCenter.current().delegate = self
UIApplication.shared.registerForRemoteNotifications()
UNUserNotificationCenter.current().requestAuthorization(
options: [.alert, .badge, .sound],
completionHandler: { (granted, error) in
print("access granted!")
guard granted else { return }
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
print("Registered: \(UIApplication.shared.isRegisteredForRemoteNotifications)")
}
})
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
The problem is, function "didRegisterForRemoteNotificationsWithDeviceToken" is never getting called.
I also created "Apple Push Notification service SSL Certificates" in my developer account, added "Push Notifications" to my capabilities in Xcode but it's still not working. Every time I tab on "Allow" to allow notifications, it says "access granted", but it does not print out any device token. "isRegisterForRemoteNotifications" also returns true.
I also searched on the internet for around 2-3 hours, but I couldn't find any solution yet.
I'm using Xcode 12 Beta 2 and iOS 14 Dev Beta 2.
Thank you.
Topic:
App & System Services
SubTopic:
Notifications
Tags:
APNS
Notification Center
User Notifications