In my case, this was an issue with the latest version of Sentry (https://github.com/getsentry/sentry-cocoa/issues/3809).
Post
Replies
Boosts
Views
Activity
I ran into this issue because I added my Widget extension as multiplatform, when I should have added 2 extensions: one for iOS, one for macOS.
Just edit the Build Settings and remove macOS or iOS from the "Base SDK" and "Supported Platforms", then create another extension for the other SDK/platform.
This is related to https://developer.apple.com/forums/thread/735268. You should see that only the first configuration is taken into account, which means that trying to Query Type.A will crash if you reverse the order, so it's not really a solution 🫤
If you don't want it to display anything, see if you can use "mis" which is the tag for "Uncoded languages".
You can find that code listed here: https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry, and it's considered a valid BCP47 value by Apple.
Did you find a solution to this?
If you're using vector files (PDF, SVG), you don't need to resize your images.
Head to the image's attributes inspector and check "Preserve vector data" in front of Resizing.
I guess you need to because that solved my issue: it would scale on iOS but not for watchOS widgets.
Thanks!
Just did that for my own app, which had a pre-existing setup that made it easy.
Essentially, it's this
@main
struct MyApp: App {
@StateObject private var appStateRegistry = AppStateRegistry.shared
var body: some Scene {
WindowGroup {
MainView()
.environmentObject(appStateRegistry)
.environmentObject(appStateRegistry.tabStateHandler)
}
}
}
// See https://www.fivestars.blog/articles/app-state/ for why we need both AppStateRegistry and TabStateHandler
class AppStateRegistry: ObservableObject {
static let shared = AppStateRegistry()
var tabStateHandler = TabStateHandler()
}
public enum MainTab: String {
case tab1, tab2, tab3
}
class TabStateHandler: ObservableObject {
@Published var selection: MainTab = .tab1
}
struct MainView: View {
@EnvironmentObject var tabStateHandler: TabStateHandler
var body: some View {
TabView(selection: $tabStateHandler.selection) {…}
}
}
And now in your AppIntent all you need to do is
// It's not the same enum since you could have more (or less) options here
public enum ShortcutableView: String, AppEnum {
case tab1, tab2
}
struct OpenViewIntent: AppIntent {
static var openAppWhenRun: Bool = true // Make sure you have this
@Parameter(title: "View")
var view: ShortcutableView
@MainActor
func perform() async throws -> some IntentResult {
switch view {
case .tab1:
AppStateRegistry.shared.tabStateHandler.selection = .tab1
case .tab2:
AppStateRegistry.shared.tabStateHandler.selection = .tab2
}
return .result()
}
}
I can confirm that @lcurry's solution work.
Also, I put the onTapGesture on the DisclosureGroup, not on the Text label.
swift
@State var isGuestsExpanded: Bool = true
var body: some View {
List() {
DisclosureGroup(isExpanded: $isGuestsExpanded, content: {
ForEach( model.guests ) { guest in GuestView(guest: guest, selectedGuests: $selectedGuests) }
}, label: {
Text("Guests")
}.onTapGesture {
withAnimation { isGuestsExpanded.toggle() }
}
}
}
The missing step for me was logging once to icloud.com, which I did thanks to @npvisual's answer here.