Post

Replies

Boosts

Views

Activity

PHPhotoLibrary.requestAuthorization just returns .denied on macOS
I am trying to implement the ability to save a photo to the user’s photo library on macOS. When I call PHPhotoLibrary.requestAuthorization(for: .addOnly) I just get a .denied status. The user is not prompted for access. I tried adding these entitlements: com.apple.security.personal-information.photos-library, com.apple.security.assets.pictures.read-write. I tried turning off sandboxing entirely. I tried saving despite getting the authorization denied, but unsurprisingly that gives me this error: Domain=PHPhotosErrorDomain Code=3311 I can almost do what i want with NSSharingService(named: .addToIPhoto), but that has the side effect of launching Photos. Is there a trick to getting PHPhotoLibrary.requestAuthorization(for: .addOnly) to work? Thanks. John
4
1
1.1k
Mar ’24
Invalid 'com.apple.application-identifier' entitlement value
I am trying to resolve this issue when uploading a Mac app with a share menu extension to App Store Connect: Invalid Provisioning Profile. The provisioning profile included in the bundle com.goldenhillsoftware.Unread2.SubscribeInUnreadExtension [com.goldenhillsoftware.Unread2.pkg/Payload/submitmac.app/Contents/PlugIns/ShareExtension.appex] is invalid. [Invalid 'com.apple.application-identifier' entitlement value.] For more information, visit the macOS Developer Portal. (ID: 01a4a823-62e9-4278-b3b5-46266b168a65) I understand that it wants a com.apple.application-identifier entitlement, but I do not understand how to provide that entitlement. I have tried putting it in the .entitlements file, but that has not worked. Is there a place where I can specify the com.apple.application-identifier entitlement associated with the App ID or when manually generating an entitlements file from the Developer Portal? I don't see it in the list of App Services associated with an App ID in the developer portal. I have seen other threads where folks seem to get past this by deleting currently downloaded provisioning profiles and using Automatically manage signing, but I have not had success with that either. Am I right that the value should be (TeamId).com.company.(AppName)? Should the entitlement include the extension itself ((TeamId).com.company.(AppName).(ExtensionName))? Thanks. John
2
0
1.8k
Feb ’23
Typing tab to navigate to a TextField in a List
I have a List that can contain TextField views on macOS. I want tabbing between the TextField views inside the List to work the way it does with TextField views that are not inside a List. But pressing the tab key to navigate to a TextField inside a List just does not seem to work. I tried attaching a focusable(false) modifier to the List and a focusable(true) modifier to the TextField views. Is there a trick to this? var body: some View { TextField("Title:", text: $title, prompt: Text("Title")) List { TextField("Title 2:", text: $title2, prompt: Text("Title 2")) TextField("Title 3:", text: $title3, prompt: Text("Title 3")) } }
0
0
663
Feb ’23
Hang when opening share sheet
When I compile my app with Xcode 14, the app fails to open share sheets. The app just hangs on the call to present( the UIActivityViewController, and eventually crashes with a memory error. I do not see this behavior when I compile with Xcode 13.4, or if I run the app on an iOS 15 device. It is just when compiled with Xcode 14 and run on an iOS 16 device. I tried creating a dedicated view controller with nothing other than a button letting the user present a share sheet. I stripped out everything in the view controller and app delegate other than what is needed to show that view controller. I still see the behavior. But I do not see this when I create a standalone app. I am looking for differences in build settings and Info.plist that might trigger this. Is there something else I should look for? This is the main thread while the app is hung, before it just crashes: Thread 1 Queue : com.apple.main-thread (serial) #0 0x000000019f4f0378 in -[UIButtonLegacyVisualProvider updateConstraints] () #1 0x000000019f4f02f8 in -[UIButton updateConstraints] () #2 0x000000019f4778bc in -[UIView(AdditionalLayoutSupport) _sendUpdateConstraintsIfNecessaryForSecondPass:] () #3 0x000000019f47767c in -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] () #4 0x000000019f477598 in -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] () #5 0x00000001b7e685d8 in -[NSISEngine withBehaviors:performModifications:] () #6 0x000000019f477378 in __100-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:]_block_invoke () #7 0x000000019f41e204 in -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] () #8 0x000000019f41def4 in -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:] () #9 0x000000019f4549ec in -[UIView(AdditionalLayoutSupport) _systemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority:hasIntentionallyCollapsedHeight:] () #10 0x000000019f94e6c0 in -[_UIButtonBarItemLayout minimumLayoutWidthGivenMinimumSpaceWidth:] () #11 0x000000019f94ed70 in -[_UIButtonBarItemGroupLayout recalculateLayoutWidthsGivenItemSpaceWidth:] () #12 0x000000019f9476c0 in -[_UIButtonBar _widthInfoForLayout:] () #13 0x000000019f988330 in -[_UINavigationBarContentViewLayout _buttonBarLayoutInfo] () #14 0x000000019f98868c in -[_UINavigationBarContentViewLayout layoutSubviews] () #15 0x000000019f398414 in -[_UINavigationBarContentView layoutSubviews] () #16 0x000000019f395a58 in -[UIView(CALayerDelegate) layoutSublayersOfLayer:] () #17 0x000000019e8baa60 in CA::Layer::layout_if_needed(CA::Transaction*) () #18 0x000000019f45a94c in -[UIView(Hierarchy) layoutBelowIfNeeded] () #19 0x000000019f52595c in -[UINavigationController _positionNavigationBarHidden:edge:initialOffset:] () #20 0x000000019f5256a8 in -[UINavigationController _positionNavigationBarHidden:edge:] () #21 0x000000019f5254c0 in -[UINavigationController __viewWillLayoutSubviews] () #22 0x000000019f5253f4 in -[UILayoutContainerView layoutSubviews] () #23 0x000000019f395a58 in -[UIView(CALayerDelegate) layoutSublayersOfLayer:] () #24 0x000000019e8baa60 in CA::Layer::layout_if_needed(CA::Transaction*) () #25 0x000000019f45a94c in -[UIView(Hierarchy) layoutBelowIfNeeded] () #26 0x000000019f45a81c in -[UISheetPresentationController _sheetLayoutInfoLayout:] () #27 0x000000019f458600 in -[_UISheetLayoutInfo _layout] () #28 0x00000001a015e080 in __54-[UISheetPresentationController _transitionWillBegin:]_block_invoke_3 () #29 0x000000019f3c0478 in +[UIView(Animation) performWithoutAnimation:] () #30 0x000000019f6c1c08 in __54-[UISheetPresentationController _transitionWillBegin:]_block_invoke_2 () #31 0x000000019f6b4af4 in -[_UIViewControllerTransitionCoordinator _applyBlocks:releaseBlocks:] () #32 0x000000019f6b49d8 in -[_UIViewControllerTransitionContext __runAlongsideAnimations] () #33 0x000000019f6b48e8 in __63+[UIView(Animation) _setAlongsideAnimations:toRunByEndOfBlock:]_block_invoke () #34 0x000000019f45a45c in -[UIViewAnimationState _runAlongsideAnimations] () #35 0x000000019f459280 in -[UIViewAnimationState pop] () #36 0x000000019f458d3c in +[UIViewAnimationState popAnimationState] () #37 0x000000019f458b48 in +[UIView _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] () #38 0x000000019f42ddd4 in +[UIView(UIViewAnimationWithBlocks) animateWithDuration:delay:options:animations:completion:] () #39 0x000000019f80554c in __50-[UITransitionView _startTransition:withDuration:]_block_invoke_2 () #40 0x000000019f4d212c in +[UIView(UIViewAnimationWithBlocks) conditionallyAnimate:withAnimation:layout:completion:] () #41 0x000000019f62b14c in -[UITransitionView _startTransition:withDuration:] () #42 0x000000019f628e7c in -[UITransitionView transition:fromView:toView:removeFromView:] () #43 0x000000019f628054 in -[UIViewControllerBuiltinTransitionViewAnimator animateTransition:] () #44 0x000000019fb199f8 in ___UIViewControllerTransitioningRunCustomTransition_block_invoke_3 () #45 0x000000019f57f664 in +[UIKeyboardSceneDelegate _pinInputViewsForKeyboardSceneDelegate:onBehalfOfResponder:duringBlock:] () #46 0x000000019f627b40 in ___UIViewControllerTransitioningRunCustomTransition_block_invoke_2 () #47 0x000000019f571e9c in +[UIView(Animation) _setAlongsideAnimations:toRunByEndOfBlock:] () #48 0x000000019f571d7c in _UIViewControllerTransitioningRunCustomTransition () #49 0x000000019fa8e6b8 in __56-[UIPresentationController runTransitionForCurrentState]_block_invoke_3 () #50 0x000000019f522f30 in -[_UIAfterCACommitBlock run] () #51 0x000000019f522e6c in -[_UIAfterCACommitQueue flush] () #52 0x00000001045e808c in _dispatch_call_block_and_release () #53 0x00000001045e98c4 in _dispatch_client_callout () #54 0x00000001045f8428 in _dispatch_main_queue_drain () #55 0x00000001045f8080 in _dispatch_main_queue_callback_4CF () #56 0x000000019853cac8 in __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ () #57 0x0000000198520754 in __CFRunLoopRun () #58 0x0000000198524dfc in CFRunLoopRunSpecific () #59 0x00000001d23da984 in GSEventRunModal () #60 0x000000019f707e7c in -[UIApplication _run] () #61 0x000000019f707af4 in UIApplicationMain () #62 0x00000001027e9604 in main at /Users/jbrayton/Documents/Unread/working/App/Unread/Supporting Files/main.m:14 #63 0x00000001b9be2de0 in start ()
4
1
1.8k
Sep ’22
Detecting Two-Finger Taps on iPad Inside Action Extension
I need to detect right-clicks / two-finger clicks with a trackpad or mouse on an iPad inside an action extension. I am finding that if I put a UITapGestureRecognizer in a view controller inside an action extension and set its allowedTouchTypes to UITouch.TouchType.indirectPointer, the gesture recognizer does not fire and none of the UIGestureRecognizerDelegate methods are ever called. The same code inside a standalone app works, just not in an action extension. This happens on both iPadOS 15.5 and iPadOS 16. I can filed FB10296917 regarding this, but it seems odd enough that I wanted to ask here whether I might be missing something.
0
0
713
Jun ’22
iCloud Backup and SQLite Databases
Is there anything to watch out for or any steps one should take with regard to iCloud Backup and data in SQLite files? I am nervous about the fact that my sqlite databases each have a .sqlite file, a .sqlite-shm file, and a .sqlite-wal file – and wondering whether iCloud backup could end up restoring different versions of these files.
0
0
704
Apr ’22
Sign in with Apple questions
I am experimenting with Sign in with Apple and I have a few questions: First, regarding initial login: An ASAuthorizationAppleIDCredential includes both an authorizationCode so that the server can perform validation, and an identityToken with a signed JWT. If my server uses the authorizationCode to get credential information from appleid.apple.com, can I safely ignore the identityToken returned to the ASAuthorizationControllerDelegate? Or is there a reason I should verify that as well. If I do not verify the identityToken should I still set a nonce on the ASAuthorizationAppleIDRequest? Second, regarding notifications of Apple ID changes: It seems like getCredentialState, server-side token requests based on refresh tokens, and Server to Server notifications all serve the purpose of letting an app find out about changes to an Apple ID. Do I need to implement all three of these, or should any one be sufficient? Finally, I am not sure I need to know about Apple ID changes at all. Can I ignore all of these, and not worry about Apple ID status changes for users already logged into a device? I do not use the account name or email address at all, just the user identifier. Thanks. John
0
0
739
Apr ’22
Difficulty playing videos from WKWebView
I am running into a weird bug where videos embedded in WKWebViews do not appear. I get audio, but the screen goes black. A few notes: This happens on iOS 15 and the 15.1 beta, but not iOS 14.8. I have three WKWebViews in the view hierarchy. If I reduce the number of WebViews to one, I do not encounter this issue. When I encounter this issue with one WebView, playing the same video from another WebView will work. It seems to happen more often when in dark mode than in light mode. This might be an Apple bug, but I have not been successful in building a standalone app that can reproduce this.I know this isn’t a lot to go on, but if anyone has pointers or can suggest something to try I would appreciate it. Thanks. John
2
0
2.0k
Sep ’21
Adding a Quick Note via Keyboard Shortcut
In earlier iPadOS betas I used the globe-Q keyboard shortcut to create a Quick Note. This no longer works for me, and I am not sure why. I do not see the keyboard shortcut listed if I hold down the globe key. Was the keyboard shortcut removed? Could the problem be that I have a Magic Keyboard (not designed specifically for an iPad) and have the function key mapped to the globe key? John
0
0
789
Sep ’21
Apps rejected by App Store Connect if they contain Objective-C dictionaries defined with @{ @"key": @"value" } notation
I have been having trouble submitting my app to App Store Connect after building it with Xcode 13. I figured out that if a project contains this Objective-C code, App Store Connect will reject the app claiming it to use NSConstantDictionary as a private API: NSDictionary *myDictionary = @{@"a":@"b", @"c":@"d" }; NSLog(@"myDictionary: %@", myDictionary); I suspect the same issue exists for NSArray, at least when written with @[@"a", @"b"] notation. I filed FB9188387 regarding this. It seems like a pretty big problem. The FB includes a very simple sample project that gets rejected with the error above. The same project archived and submitted by Xcode 12.5 is accepted. The FB also contains a copy of this sample project with the two lines above commented out. That is accepted and processed by App Store Connect. John
0
0
1.1k
Jun ’21
Formatted Text Options
I understand that I cannot display attributed strings in SwiftUI, and therefore that I cannot display them in widgets. Am I right that there is also no ability to use Core Text to display formatted strings in widgets? It looks to me like my options for displaying text in widgets are Text views and images generated by my app. I just want to confirm that this is the case. Thanks.
0
0
649
Jul ’20
Registering custom fonts from a framework in a widget extension
I want a widget to use the same custom fonts that the containing app uses. I do not want multiple copies of the font files in the app bundle. I put the font files into a framework shared by the app and the widget extension. I have code to register the fonts from the framework bundle using CTFontManagerRegisterGraphicsFont. That works from the app, but it does not work from the widget extension because it requires UIKit. (At least I think that's why it doesn't seem to work from my widget extension.) Widgets cannot run UIKit code. Is there a way to programmatically register the fonts in a widget? If not is there a way I can make a UIAppFonts Info.plist entry point to a framework?
6
1
5.6k
Jul ’20
Apply custom fonts and colors to context menus
I am looking for a way to apply custom fonts and colors to context menus. I was able to change UIAction text color with the appearance manager:[[[UILabel class] appearanceWhenContainedInInstancesOfClasses:@[NSClassFromString(@"_UIContextMenuActionView")]] setTextColor:[UIColor greenColor]];But doing the same with the font does not work for me:[[[UILabel class] appearanceWhenContainedInInstancesOfClasses:@[NSClassFromString(@"_UIContextMenuActionView")]] setFont:[UIFont systemFontOfSize:30]];Similarly I cannot find a way to apply custom colors to the separator lines between UIActions or inline UIMenus.Is there a way to do this?Thanks.John
2
0
2.4k
Sep ’19