Post

Replies

Boosts

Views

Activity

Presenting GroupActivitySharingController using SwiftUI on MacOS
I am trying to present a GroupActivitySharingController using SwiftUI. I am using a NSViewControllerRepresentable: @State var event : Event func makeNSViewController(context: NSViewControllerRepresentableContext<MeetingGroupActivitySharingRepresentableView>) -> GroupActivitySharingController { return try! GroupActivitySharingController(MeetingGroupActivity(event: event)) } func updateNSViewController(_ nsViewController: GroupActivitySharingController , context: NSViewControllerRepresentableContext<MeetingGroupActivitySharingRepresentableView>) { print("Updating VC") } } I present it as following : .sheet(isPresented: $showGroupActivitySharingView) { MeetingGroupActivitySharingRepresentableView(event: observedEvent.event) } It works fine on iOS, however on MacOS, I cannot dismiss the view. I see the following error: dismissViewController:: Error: maybe this view controller was not presented? ( 0 CoreFoundation 0x000000019d75accc __exceptionPreprocess + 176 1 libobjc.A.dylib 0x000000019d242788 objc_exception_throw + 60 2 Foundation 0x000000019e8cbc6c -[NSCalendarDate initWithCoder:] + 0 3 AppKit 0x00000001a145a77c -[NSViewController dismissViewController:] + 224 4 _GroupActivities_AppKit 0x0000000232d65cf0 $s23_GroupActivities_AppKit0A25ActivitySharingControllerC011dismissViewG06resultyAA0aeF6ResultO_tFyyYaYbScMYccfU_TY0_ + 444 5 _GroupActivities_AppKit 0x0000000232d67b65 $s23_GroupActivities_AppKit0A25ActivitySharingControllerC011dismissViewG06resultyAA0aeF6ResultO_tFyyYaYbScMYccfU_TATQ0_ + 1 6 _GroupActivities_AppKit 0x0000000232d68bd9 $sIeghH_ytIeghHr_TRTQ0_ + 1 7 _GroupActivities_AppKit 0x0000000232d68bdd $sIeghH_ytIeghHr_TRTATQ0_ + 1 8 _GroupActivities_AppKit 0x0000000232d66931 $sxIeghHr_xs5Error_pIegHrzo_s8SendableRzs5NeverORs_r0_lTRyt_Tg5TQ0_ + 1 9 _GroupActivities_AppKit 0x0000000232d68ba5 $sxIeghHr_xs5Error_pIegHrzo_s8SendableRzs5NeverORs_r0_lTRyt_Tg5TATQ0_ + 1 10 libswift_Concurrency.dylib 0x0000000263cfb0f9 _ZL23completeTaskWithClosurePN5swift12AsyncContextEPNS_10SwiftErrorE + 1 ) Any idea what is going on?
0
0
446
Apr ’24
Group Activities Entitlements on MacCatalyst
I am adding Group Activities integration with a MacCatalyst app. I have added the Group Activities entitlement in Xcode. I also checked the entitlements with : codesign --display --entitlements :- I can see the entitlement : <key>com.apple.developer.group-session</key><true/><key> The feature work fine on iPadOS but when I run it on MacOS, the GroupActivitySharingController is not loading properly. I get the following error messages: Cannot run query EXQuery: extension point com.apple.groupactivities platforms: 6 with error: (null) Failed to lookup extension with query EXQuery: extension point com.apple.groupactivities platforms: 6 on <_GroupActivities_UIKit.PeoplePickerController: 0x600005020980> Failed to fetch config for hostViewController <_GroupActivities_UIKit.PeoplePickerController: 0x600005020980> Failed to build remote hostViewController for <_GroupActivities_UIKit.GroupActivitySharingController: 0x1417f1250> Failed to fetch extensionViewController Calling -viewDidAppear: directly on a view controller is not supported, and may result in out-of-order callbacks and other inconsistent behavior. Use the -beginAppearanceTransition:animated: and -endAppearanceTransition APIs on UIViewController to manually drive appearance callbacks instead. Make a symbolic breakpoint at UIViewControllerAlertForAppearanceCallbackMisuse to catch this in the debugger. View controller: <_GroupActivities_UIKit.GroupActivitySharingController: 0x1417f1250> I got a similar error on iPadOS when the entitlement was not added. Now that I have the entitlement, the error appears only on MacOS. Does MacOS/MacCatalyst use a different entitlements file? What could be cuasing this?
0
0
545
Mar ’24
SPM "***" is only available in iOS 15.0 or new error
I have a project with a deployment target set to iOS 16.4. The project includes a local framework target whose deployment target is also set to iOS 16.4 in build settings. The build settings for the parent app target also show iOS 16.4 deployment target. However, when I try to compile the parent app I get a series of "***" is only available in iOS 15.0 or newer errors when it tries to build the embedded framework. I am using SPM to manage dependencies.
0
1
505
Jan ’24
MenuBarExtra for Mac Catalyst App
I have a Mac Catalyst App that I switched over to the SwiftUI lifecycle. I am trying to add MenuBarExtra to the app : if #available(macOS 13.0, *) { MenuBarExtra("....", systemImage: ......) { .......... } } However, I get an error : 'init(_:systemImage:content:)' is unavailable in iOS 'MenuBarExtra' is unavailable in iOS How do I add MenuBarExtra to the app?
4
0
886
Nov ’23
UICollectionView custom layout cells missing after inactive state
I have a collection view with a custom layout and a diffable datasource. The collection view displays and behaves correctly when the app is launched intially. I then switch over to another app and then switch back to my app. Once dataSource.apply(snapshot, animatingDifferences: false) is executed things haywire: The cells, supplementary views and decoration views go missing. When I look at the view debugger, the collection view is in the view hierarchy but there are no child views UIApplication.didBecomeActiveNotification is received. The following functions from my custom layout are called: prepare() layoutAttributesForElements(in rect: CGRect) - attributes for cells are being returned layoutAttributesForItem(at indexPath: IndexPath) layoutAttributesForSupplementaryView(ofKind elementKind: String, at indexPath: IndexPath) layoutAttributesForDecorationView(ofKind elementKind: String, at indexPath: IndexPath) I have verified that these methods do return layout attributes for cells and the other views. However, the datasource callback requests for cells are not being called and the cells are not displayed. Any ideas what is going on? This only happens on device and not in the simulator. This is on iOS 13.5
0
0
558
Jul ’20
Catalyst Drag and Drop
I am unable to get drag and drop working on Catalyst while the same code works fine on iOS:func tableView(_ tableView: UITableView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -&gt; [UIDragItem] { let task = tasksBySection[indexPath.section][indexPath.row] let itemProvider = NSItemProvider(object: task.taskID as NSString) let dragItem = UIDragItem(itemProvider: itemProvider) dragItem.localObject = task return [dragItem] }The drag delegate function completes successfully and then I see the following error messages: -[__NSCFType _stopDraggingUpdates]: unrecognized selector sent to instance 0x60000370c0c02020-03-09 16:32:41.967468-0700 MyApp[57587:599370] -[__NSCFType _setTarget:]: unrecognized selector sent to instance 0x60000370c0c02020-03-09 16:32:41.972714-0700 MySpp57587:599370] [General] -[__NSCFType _setTarget:]: unrecognized selector sent to instance 0x60000370c0c02020-03-09 16:32:41.991528-0700 MyApp[57587:599370] [General] ( 0 CoreFoundation 0x00007fff384778ab __exceptionPreprocess + 250 1 libobjc.A.dylib 0x00007fff6e731805 objc_exception_throw + 48 2 CoreFoundation 0x00007fff384f6b61 -[NSObject(NSObject) __retain_OA] + 0 3 CoreFoundation 0x00007fff383dbadf ___forwarding___ + 1427 4 CoreFoundation 0x00007fff383db4b8 _CF_forwarding_prep_0 + 120 5 AppKit 0x00007fff3593b789 NSCoreDragTrackingProc + 2513 6 HIServices 0x00007fff36605eac DoTrackingMessage + 380 7 HIServices 0x00007fff3660531f CoreDragStartDragging + 939 8 AppKit 0x00007fff3593a720 -[NSCoreDragManager _dragUntilMouseUp:accepted:] + 1304 9 AppKit 0x00007fff35b8b19e _handleBeginDraggingSession + 105 10 CoreFoundation 0x00007fff383fb0ee __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23 11 CoreFoundation 0x00007fff383fb014 __CFRunLoopDoObservers + 457 12 CoreFoundation 0x00007fff383f9b79 CFRunLoopRunSpecific + 409 13 HIToolbox 0x00007fff36f4f65d RunCurrentEventLoopInMode + 292 14 HIToolbox 0x00007fff36f4f39d ReceiveNextEventCommon + 600 15 HIToolbox 0x00007fff36f4f127 _BlockUntilNextEventMatchingListInModeWithFilter + 64 16 AppKit 0x00007fff355bfba4 _DPSNextEvent + 990 17 AppKit 0x00007fff355be380 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352 18 AppKit 0x00007fff355b009e -[NSApplication run] + 658 19 AppKit 0x00007fff35582465 NSApplicationMain + 777 20 AppKit 0x00007fff358a569c _NSApplicationMainWithInfoDictionary + 16 21 UIKitMacHelper 0x00007fff693d08f1 UINSApplicationMain + 322 22 UIKitCore 0x00007fff76278273 UIApplicationMain + 2105 23 MyApp 0x0000000100188c0b main + 75 24 libdyld.dylib 0x00007fff6fa9f7fd start + 1 25 ??? 0x0000000000000003 0x0 + 3)
7
0
2.0k
Mar ’20
Mac Catalyst Push notifications
I am trying to get push notifications working for my Catalyst app and am running into two problems :1, When I call UNUserNotificationCenter.current().requestAuthorization, the app does not show a dialog asking the user to authorize notifications (similar to iOS)2, I am using Firebase Cloud Messaging (https://firebase.google.com/docs/cloud-messaging) as my messaging backend. I am unable to send push notifications and see the following error:Error: Auth error from APNS or Web Push Service Raw server response: "{"error":{"code":401,"message":"Auth error from APNS or Web Push Service","status":"UNAUTHENTICATED","details":[{"@type":"type.googleapis.com/google.firebase.fcm.v1.FcmError","errorCode":"THIRD_PARTY_AUTH_ERROR"}]}The same setup with no changes works fine when I build for iOS but fails for Catalyst.Do I need additional configuration changes to enable push notifications for Catalyst?I am building with Xcode 11.3.1.
1
1
1.6k
Mar ’20
Crash in multi-window Catalyst App
There is a crash in multi-window Catalyst Mac apps (iPad apps built for Mac). Steps to reproduce:1, Download Apple's multi-window sample code (https://developer.apple.com/documentation/uikit/app_and_environment/scenes/supporting_multiple_windows_on_ipad)2, Enable the Mac platform and build3, Launch app4, Open another window from File-&gt;New5, Close new window6, Open another new window from File-&gt;New7, The app crashes.Error Messages:Unable to create a new scene. Error: Error Domain=BSServiceConnectionErrorDomain Code=3 "(null)" UserInfo={BSErrorCodeDescription=OperationFailed}When I build with Address Sanitizer and Zombie objects enabled, I see the following error message:Gallery[15640:3666137] *** -[UIWindow isProxy]: message sent to deallocated instance 0x618000072c80I have tested other multi-window Catalyst apps including my own and see the same crash in all of the apps.I have submitted a bug using Apple's feedback assistant(FB7571990). I am seeing this in Catalina 10.15.3.Are there any workarounds for this problem?
2
0
2.0k
Feb ’20
dyld: Library not loaded: /System/Library/Frameworks/SwiftUI.framework/SwiftUI
I am introducing SwiftUI to an existing app that also supports iOS 12. I have availability checks around the SwiftUI Code :@available(iOS 13.0, *)The code compiles fine and runs on iOS 13. However, when I run the app iOS 12 (Simulator/actual device), the app crashes:dyld: Library not loaded: /System/Library/Frameworks/SwiftUI.framework/SwiftUI Referenced from: ..... Reason: no suitable image found. Did find: /System/Library/Frameworks/SwiftUI.framework/SwiftUI: mach-o, but not built for iOS simulatorThe app crashes when running on an iOS 12 device as well, so not just a simulator problem. I tried wrapping the import statements in #if canImport but that does not help:#if canImport(SwiftUI)Essentially, I am trying to implement new features that run on iOS 13 + MacCatalyst only using SwiftUI while still allowing the app to run on iOS 12 (without the new SwiftUI features)
2
3
13k
Dec ’19