Post

Replies

Boosts

Views

Activity

iOS 13.4 beta: onDrop doesn’t work with List or Views inside it
I am trying to use the new onDrop feature of iOS13.4. It works for me on Stacks, Text views, Buttons and such.However onDrop is not called on a List, or any views (for instance a custom row view, or a button) when they are inside of a list.This seems like a bug?Ultimately, what I want to do is drag something from a DetailView, onto a particular row in a List inside a NavigationView, and have it added to the model associated with that row / detail view, but I can't if the List is swallowing the onDrop calls.in this code you can drag "Test Person" (PersonRow) onto the VStack, registers fine, onto "Another Test Person" (PersonRow) and that registers find, but you cannot drop onto the List itself or the PersonRows inside the List.//: A UIKit based Playground for presenting user interface import SwiftUI import PlaygroundSupport struct Person: Identifiable, Hashable { var id = UUID() var name: String } struct PersonRow: View { @State var targeted: Bool = true var person: Person var body: some View { HStack { Image(systemName: "person.circle") Text(person.name) Text(person.id.description) } .onDrop(of: ["public.utf8-plain-text"], isTargeted: self.$targeted) { item in DispatchQueue.main.async { print("onDrop PersonRow: \(item.description)") } return true } .onDrag { let item = NSItemProvider(object: NSString(string: self.person.name)) item.suggestedName = self.person.name print("onDrag: \(item)") return item } } } struct MyView : View { var people: [Person] = [Person(name: "George"), Person(name: "The Kurruth"), Person(name: "The Other")] @State var targeted: Bool = true var body: some View { VStack { Text("Test") Text("") PersonRow(person: Person(name:"Test Person")) Text("---------------------") PersonRow(person: Person(name:"Another Test Person")) //List() { ScrollView() { ForEach(people) { person in PersonRow(person: person) } } .onDrop(of: ["public.utf8-plain-text"], isTargeted: self.$targeted) { item in DispatchQueue.main.async { print("onDrop ScrollView: \(item.description)") } return true } } } } // Present the view controller in the Live View window PlaygroundPage.current.setLiveView(MyView())(edit to tidy code)
3
0
1.5k
Feb ’20
How to handle URL callbacks with new SwiftUI @main startup?
In the old SwiftUI app initialization there was UIApplicationDelegate and UIWindowSceneDelegate. I was handling a URL callback in the SceneDelegate using the method: func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) However in the new app initialization there is no SceneDelegate, nor an appropriate property like there is UIApplicationDelegateAdaptor for UIApplicationDelegate I tried using the method but it is not called. func application( _ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:] ) -> Bool So my question is, how do I handle a callback url in the new app setup?
4
0
8.9k
Jun ’20
WeatherKit - getting many errors including "The file “Weather” couldn’t be opened because you don’t have permission to view it."
I have upgraded from macOS 12.5.4 to macOS 13 Beta 1. Haven't done anything odd. I am attempting to use WeatherKit but I am getting a lot of (odd) errors: The sample can't access the ~/Library/Weather/ folder despite it being set to read for users, others and group. (I've since switched to read and write for all, but no dice). Lots of other odd errors. 2022-06-11 22:52:26.720487+0100 PlayWithWeatherKit[16282:277975] [WeatherService] Couldn't get access to the /Library/Weather directory for the geocode Store. error=Error Domain=NSCocoaErrorDomain Code=257 "The file “Weather” couldn’t be opened because you don’t have permission to view it." UserInfo={NSUserStringVariant=(     Folder ), NSURL=file:///Users/tarasis/Library/Weather, NSFilePath=/Users/tarasis/Library/Weather, NSUnderlyingError=0x6000013d4b70 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}} PlayWithWeatherKit[16282:277975] [] networkd_settings_read_from_file Sandbox is preventing this process from reading networkd settings file at "/Library/Preferences/com.apple.networkd.plist", please add an exception. PlayWithWeatherKit[16282:277975] [] networkd_settings_read_from_file Sandbox is preventing this process from reading networkd settings file at "/Library/Preferences/com.apple.networkd.plist", please add an exception. PlayWithWeatherKit[16282:277975] [WeatherDataService] Failed to create the weather data store, error=cantOpen(message: "authorization denied", location: TeaDB.Database.Location.path("/Users/tarasis/Library/Weather/weather-data.db")) PlayWithWeatherKit[16282:277991] [Metadata] unable to get a dev_t for store 1795162192. PlayWithWeatherKit[16282:277991] [] nehelper sent invalid response: <dictionary: 0x1ffa87480> { count = 1, transaction: 0, voucher = 0x0, contents = "XPCErrorDescription" => <string: 0x1ffa87618> { length = 18, contents = "Connection invalid" } } PlayWithWeatherKit[16282:277991] [] nw_parameters_set_source_application_by_bundle_id_internal Failed to convert from bundle ID (net.tarasis.test.wwdc.Playground) to UUID. This could lead to wrong data usage accounting. PlayWithWeatherKit[16282:277991] [connection] nw_endpoint_flow_validate_delegation [C1 weather-data.apple.com:443 in_progress parent-flow (satisfied (Path is satisfied), interface: en0, ipv4, ipv6, dns)] Network Delegation Failure: Invalid Bundle ID "net.tarasis.test.wwdc.Playground" [M] PlayWithWeatherKit[16282:277991] [] nw_resolver_can_use_dns_xpc_block_invoke Sandbox does not allow access to com.apple.dnssd.service PlayWithWeatherKit[16282:277991] dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:14 Err:-1 Errno:1 Operation not permitted PlayWithWeatherKit[16282:277991] [connection] nw_resolver_create_dns_service_locked [C1.1] DNSServiceCreateDelegateConnection failed: ServiceNotRunning(-65563) PlayWithWeatherKit[16282:277991] Connection 1: received failure notification PlayWithWeatherKit[16282:277991] Connection 1: failed to connect 10:-72000, reason -1 PlayWithWeatherKit[16282:277991] Connection 1: encountered error(10:-72000) PlayWithWeatherKit[16282:277975] Task <0D654665-D88F-4C81-ABDA-FBFAAC0B01E5>.<1> HTTP load failed, 0/0 bytes (error code: -1003 [10:-72000]) PlayWithWeatherKit[16282:277975] Task <0D654665-D88F-4C81-ABDA-FBFAAC0B01E5>.<1> finished with error [-1003] Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={_kCFStreamErrorCodeKey=-72000, NSUnderlyingError=0x6000013b0060 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" UserInfo={_NSURLErrorNWPathKey=satisfied (Path is satisfied), interface: en0, ipv4, ipv6, dns, _kCFStreamErrorCodeKey=-72000, _kCFStreamErrorDomainKey=10}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <0D654665-D88F-4C81-ABDA-FBFAAC0B01E5>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(     "LocalDataTask <0D654665-D88F-4C81-ABDA-FBFAAC0B01E5>.<1>" ), NSLocalizedDescription=A server with the specified hostname could not be found., NSErrorFailingURLStringKey=https://weather-data.apple.com/v2/token, NSErrorFailingURLKey=https://weather-data.apple.com/v2/token, _kCFStreamErrorDomainKey=10} PlayWithWeatherKit[16282:277975] [WeatherService] Encountered an error when fetching weather data subset; location=<+37.32299800,-122.03218100> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2022/06/11, 22:52:26 British Summer Time,  error=Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={_kCFStreamErrorCodeKey=-72000, NSUnderlyingError=0x6000013b0060 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" UserInfo={_NSURLErrorNWPathKey=satisfied (Path is satisfied), interface: en0, ipv4, ipv6, dns, _kCFStreamErrorCodeKey=-72000, _kCFStreamErrorDomainKey=10}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <0D654665-D88F-4C81-ABDA-FBFAAC0B01E5>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(     "LocalDataTask <0D654665-D88F-4C81-ABDA-FBFAAC0B01E5>.<1>" ), NSLocalizedDescription=A server with the specified hostname could not be found., NSErrorFailingURLStringKey=https://weather-data.apple.com/v2/token, NSErrorFailingURLKey=https://weather-data.apple.com/v2/token, _kCFStreamErrorDomainKey=10}
3
0
2.1k
Jun ’22
Messages Extension Mac-catalyst & macOS Sonoma
Hi according to the documentation we can have Message extensions in Mac Catalyst 14+, and that the MSStickerBrowserView is supported from Mac Catalyst 13.1+. But it doesn't seem possible to actually build an extension app, or Sticker extension, embedded in a Mac Catalyst app and have it appear in macOS messages. Error: iMessage Applications are not available when building for Mac Catalyst. and error: iMessage / Sticker Pack extensions are not available when building for Mac Catalyst. With the announcement for macOS Sonoma that the Stickers will be available in Mac Messages, is this finally going to be possible? If this isn't possible, why is there support for Mac Catalyst?
1
2
1k
Jun ’23