That was it, thank you so much!
Post
Replies
Boosts
Views
Activity
Just a few more details: I found that disabling autoresizing mask and setting individual constraints on the collection view fixes the problem:
private func configureHierarchy() {
		collectionView = UICollectionView(frame: view.bounds, collectionViewLayout: createLayout())
		collectionView.delegate = self
		collectionView.translatesAutoresizingMaskIntoConstraints = false
		view.addSubview(collectionView)
		NSLayoutConstraint.activate([
				collectionView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
				collectionView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
				collectionView.topAnchor.constraint(equalTo: view.topAnchor),
				collectionView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
		])
}
Not sure thought if this is how it was supposed to work, or if it's a bug with the .flexibleWidth autoresize mask.
The only thing that still bothers me is that it takes a while for the collection view to assume the .sidebar appearance. When opening the app for the first time, it seems that the collection view has the .sidebarPlain appearance, and then it changes to .sidebar. But I am initializing the layout list configuration with the .sidebar, so not sure why this happens.
This suddenly started to happen with me too, a few days ago. Have you been able to find a solution?
I was able to fix this by turning the App Groups capability off and on on all of my app target's on the Signing & Capabilities tab on Xcode.
It now works as expected on beta 5.
It now works as expected on beta 5.
Thanks for the update @JoeKun!
I'll wait for the fix to be deployed. In the meantime, please let me know if you need more details about the problem, or if I can help in any other way.
Thanks!
I think this is a Catalyst bug, as I'm also encountering this same situation: didUpdateLocations is never called. Here I'm using it inside the main app, so I don't think it has something to do with Widgets.
I have seen similar issues when sharing from the Music app. Some users reported that my action extension disappeared from the share sheet, and the only way to make it reappear is to restart the phone.
I have exactly the same problem. Have you found a way to express this?
I'm having this exact same problem. Here's my error message: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'the view returned from -collectionView:viewForSupplementaryElementOfKind:atIndexPath: does not match the element kind it is being used for. When asked for a view of element kind 'UICollectionElementKindSectionHeader' the data source dequeued a view registered for the element kind 'FeedCollectionViewHeader'.'
Now on iOS 15.0+ you can initialize a button with the ButtonRole .destructive:
Button(role: .destructive, action: { print(""}) {
Label("Delete", systemImage: "trash")
}
Turns out that the NSSecureCoding content was the URL, but in hexadecimal. Here's how I'm converting it to String:
let urlHex = dict.debugDescription
.replacingOccurrences(of: "Optional(", with: "")
.replacingOccurrences(of: ")", with: "")
.replacingOccurrences(of: "<", with: "")
.replacingOccurrences(of: ">", with: "")
.replacingOccurrences(of: " ", with: "")
guard let urlHexData = Data(fromHexEncodedString: urlHex) else { return }
guard let url = String(data: urlHexData, encoding: .utf8) else { return }
extension Data {
// From http://stackoverflow.com/a/40278391
init?(fromHexEncodedString string: String) {
func decodeNibble(u: UInt16) -> UInt8? {
switch(u) {
case 0x30 ... 0x39:
return UInt8(u - 0x30)
case 0x41 ... 0x46:
return UInt8(u - 0x41 + 10)
case 0x61 ... 0x66:
return UInt8(u - 0x61 + 10)
default:
return nil
}
}
self.init(capacity: string.utf16.count/2)
var even = true
var byte: UInt8 = 0
for c in string.utf16 {
guard let val = decodeNibble(u: c) else { return nil }
if even {
byte = val << 4
} else {
byte += val
self.append(byte)
}
even = !even
}
guard even else { return nil }
}
}
I found a solution thanks to this Gist. There's no way to directly convert from an EntityQuerySort to an NSSortDescriptor. Instead, we have to convert it manually:
private func toSortDescriptor(_ sortedBy: [Sort<ArtistEntity>]) -> [NSSortDescriptor] {
var sortDescriptors = [NSSortDescriptor]()
if let sort = sortedBy.first {
switch sort.by {
case \.$name:
sortDescriptors.append(NSSortDescriptor(keyPath: \EArtist.name, ascending: sort.order == .ascending))
default:
break
}
}
return sortDescriptors
}
Thanks! I’ve created FB14079140 and I’ll give the workarounds a try in the meantime.