Post

Replies

Boosts

Views

Activity

Reply to How do I access Finder's 'Get Info' file kinds?
@eskimo I'm afraid that doesn't help. Did you mean to grab it some other way? I tested it un-sandboxed too btw and the file kind appears normally but the size is still incorrect. I went into detail on what I've tried on Stack Overflow var fileResources: URLResourceValues? let keys: Set<URLResourceKey> = [ .localizedTypeDescriptionKey, .fileSizeKey, ] DispatchQueue.global(qos: .background).async { do { guard let resources = try self.url?.resourceValues(forKeys: keys) else { return } self.fileResources = resources } catch {} DispatchQueue.main.asyncAfter(deadline: .now() + 1) { print(self.fileResources?.localizedTypeDescription) print(self.fileResources?.fileSize) } }
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’21
Reply to How do I get the correct URL.resourceValues for an iCloud file that isn't downloaded?
I was able to get in contact with Developer Technical Support. There's no real answer to this problem unfortunately as there is no public API. Here is what DTS said ⤵︎ Thanks for your patience. I am writing to confirm that there is currently no public API to get the metadata for an un-downloaded >iCloud file. If later on you believe that it has a significant negative impact for your app, please feel free to file a feedback >report for the relevant engineering team to evaluate. There is however a way to sort of get a working solution as suggested by DTS. You can automatically download the file from iCloud prior to reading its metadata but I wasn't keen on this solution. ⤵︎ var error: NSError? let fileCoordinator = NSFileCoordinator() // `theULR` should be the URL without the ‘.’ & ‘.icloud’ components. fileCoordinator.coordinate(readingItemAt: theURL, options: .withoutChanges, error: &error) { newURL in    print('\(newURL)') // Try to get the meta data here. } After fiddling with this I think the best solution, for now, is to not attempt to get any metadata that could be incorrect from a non-downloaded iCloud file.
Topic: Programming Languages SubTopic: Swift Tags:
Jul ’21
Reply to Safari Web Extension Handler doesn't respond to Message when neither Debugger nor Console is attached
I'm not sure if this will help you or not but I was having this issue and this post helped me out! https://developer.apple.com/forums/thread/13038 I was registering defaults (.register(defaults: ...) but it turns out those are only held in memory and aren't actually in persistent storage. So you just have to .set the defaults to get them to be stored persistently! My extension could read the values after that.
Topic: App & System Services SubTopic: Core OS Tags:
Nov ’21