Hi,
The presentation "Capture Machine Readable Codes and Text with VisionKit" mentions at the end that the DataScannerViewController can be used with an async stream. In the presentation, there is a code snipper for the updateViewAsyncStream method, but it's not really used anywhere. How do utilize this when the DataScannerViewController is active and capture the recognized items?
Also there is a sendDidChangeNotification() function sat the end but the compiler complains that it's not in scope.
Thanks.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi,
I can't seem to find a way to view the Build Timeline with Xcode 14. I see a "Recent Build Timeline" option in the drop-down when I click on the top-left button in the editor (where "Recent Files" lives), but it doesn't do anything.
Do I have to build the app in some special way to make this visible?
Hi,
I want to query the user's current location from my widget, so I added have the 'NSWidgetWantsLocation' key in my widget's Info.plist, and added the code to find the location with CLLocationManager. But now if I launch the app for the very first time, before I even interact with the widget or do anything else, I start seeing the location permissions prompt which says "Allow <MyApp> to use your location".
If I ignore it for a few seconds, the prompt goes away, but it's back the next time the app launches. It makes for a poor user experience for users who just download the app to try it out, and might not care about the widget at all.
Why would this be happening? Does the widget run in the background even if the user never even launched the widget-picker mode? How would I know when the user *has* opened the widget, so I can see if I need to ask for location permissions or not?
Here's what I've tried: deleting the app, and then resetting Privacy prompts (same problem)
setting 'NSWidgetWantsLocation' to No stops the prompt from showing up, but defeats the purpose of finding the user's location
Thanks for the help.
Hi,
Is DataScannerViewController available to be called directly from Objective-C? I see the header file has an "objc" attribute on it, but trying to initialize it from an Objective-C file doesn't seem to be working for me. Maybe it's something I'm doing wrong, but I wanted to first clarify and confirm that if it indeed possible to use it directly in Objective-C, or not?
The iPhone 14 Pro has a A16 Bionic chip with 16 Billion transistors, two performance cores + 4 high-efficiency cores, a 5-core GPU and 16-core neural engine, and can perform 4 trillion OPS per photo. But sadly, we can only schedule up to 64 User Notifications on it (per app). This limitation has been there since iOS3 I believe, when UILocalNotifications were first introduced, along with the iPhone 3G.
What gives? Why does this limit never seem to change? I would love to understand the reasons. I am trying to build a 'timer' app, and can't understand how to build one with this limitation in place (unless I use Remote Push notifications, which requires a lot of infrastructure outside the app).
Btw, I filed a Radar for this 5 years ago, which was changed to this Feedback Request: FB5978935
Hi,
I have an NSOutlineView, and each cell within that has an NSCollectionView (a horizontal one), setup using autolayout with the 'height' of the collectionView driving the height of the OutlineView cell. Each item in the collectionView can have a dynamic width, and I use a 'dummy' collectionView to size each item from it's contents, then getting the height of the collectionView and using a 'height constraint' to make each collectionView get the height it needs (and hence the cell have a dynamic height.
It works fine for the most part, but I get this warning multiple times in the console:
"The behavior of the UICollectionViewFlowLayout is not defined because: the item width must be less than the width of the UICollectionView minus the section insets left and right values, minus the content insets left and right values.
The relevant UICollectionViewFlowLayout instance is <NSCollectionViewFlowLayout: 0x10e3b7f80>, and it is attached to <MacTagsCustomCollectionView: 0x10e3b7840>.
Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger."
I've tried Googling this, but I can't find a good explanation for this issue. Also, I'm not sure why it references 'UICollectionViewFlowLayout' when it's an AppKit app and uses NSCollectionView. Also, setting the 'UICollectionViewFlowLayoutBreakForInvalidSizes' symbolic breakpoint doesn't help since it never gets triggered.
Here is some code from my outlineView's viewForTableColumn, where I get the height of the collectionView and hence the height of the cell:
result = [outlineView makeViewWithIdentifier:@"DataWithTags" owner:self];
if (result.tagListCollectionView.delegate == nil) {
result.tagListCollectionView.delegate = self;
result.tagListCollectionView.dataSource = self;
result.tagsCollectionViewScrollView.automaticallyAdjustsContentInsets = NO;
result.tagListCollectionView
NSNib *cellNib = [[NSNib alloc] initWithNibNamed:@"MacTagsForPersonItem" bundle:nil];
[result.tagListCollectionView registerNib: cellNib forItemWithIdentifier:@"PersonTagsCollectionViewItemID"];
if (self.tagsSizingItem == nil) {
NSArray *topLevelObjects;
[cellNib instantiateWithOwner:self.tagsSizingItem topLevelObjects: &topLevelObjects];
for (id topLevelObject in topLevelObjects) {
if ([topLevelObject isKindOfClass:[MacPersonTagsCollectionViewItem class]]) {
self.tagsSizingItem = topLevelObject;
break;
}
}
}
result.tagListCollectionView.backgroundColors = @[[NSColor clearColor]];
result.tagListCollectionView.enclosingScrollView.backgroundColor = [NSColor clearColor];
result.tagsCollectionViewScrollView.verticalScroller.hidden = YES;
}
result.tagListCollectionView.tagsPerson = person;
[result.tagListCollectionView reloadData];
result.frame = outlineView.bounds;
[result layoutSubtreeIfNeeded];
[result.tagListCollectionView layoutSubtreeIfNeeded];
if (person.tagsCacheHeight == 0) {
	 person.tagsCacheHeight = result.tagListCollectionView.collectionViewLayout.collectionViewContentSize.height;
}
result.collectionViewHeightConstraint.constant = person.tagsCacheHeight;
Anyone with any idea on how to overcome this? I feel that it's responsible for some layout issues that I'm having in the view.
Hi,
With StoreKit2 giving us the up-to-date subscription status using Transaction.currentEntitlements, is there any value in storing the status separately in keychain as well? Or will that just add an unnecessary layer to manage (and possibly mess up)? I just want to subscription status to know if I need to unlock certain features in the app or not, and wondering if just looking at currentEntitlements and saving that in my Store object is enough.
Thanks.
I recently had to make a change to my Mac app where I need to add a special "Contact Notes" entitlement, so that means that I can't rely on "Automatic Code Signing" anymore. So here are the steps I took to build and distribute the app with manual code signing:
from "Certificates, Identifiers & Profiles" from the Developer, I added entitlement to my app identifier, and then created new manual provisioning profiles (one for "macOS App Development" under Development, and one for "Mac App Store" under Distribution)
in Xcode, added the entitlement to the Entitlements files
in Xcode, in Signing & Capabilities, unselected the checkbox for "Automatically manage signing", and under "Provisioning Profile", for both Debug and Release builds, I chose to import the new provisioning profiles that were created
I can build and run in debug mode, and it works fine. I then created an 'archive' of the app, which also built fine, and opened up Organizer.
In Organizer, I choose the "Distribute" button, select "App Store Connect" as the distribution method, and choose "Upload" as the destination. After it prepares the archive, it shows the usual two checkboxes for "upload app symbols" and "manage version and build number", and I select Next.
Till now, everything works as expected.
Now I get the "Select certificates and Mac App Store profiles" page ... here, for the dropdowns for my app's targets, I select the correct provisioning profiles. BUT .. the "Next" button never next gets enabled, so I can't move forward! There's no error message, or anything in Console that makes sense to me. But I just can't seem to be able to select "Next" to the final step before uploading the build to App Store Connect.
When I went back and selected "Automatically manage signing" again, and build and archive, the new archive doesn't have this step again, so it works fine and goes to the final upload page.
What can I do to find out the issue that's causing this page to not validate? Can I upload the archive build through some other way (like from Terminal) that might give more information?
NEVERMIND: turns out, I needed to "Mac Installer Distribution" Certificate, which I generated from the dropbox.
I have been using CLGeocoder’s “geocodePostalAddress” API for many years, and it’s been working just fine. Since yesterday, a lot of users have started complaining that they are getting “no results” for their geocoding requests, and I have also confirmed this case. It seems like the “geocodePostalAddress” returns “No Result” in many cases where it used to work correctly before, even though the “geocodeAddressString” API still works correctly. Has anyone else noticed this problem? Has there been some server change that is causing this?
Here's a unit test I wrote to test this out:
import CoreLocation
final class CJTestCLGeocoderRequests: XCTestCase {
func testGeocoderWithCNPostalAddressBerkeley() async throws {
let geocoder = CLGeocoder()
do {
let postalAddress = CNMutablePostalAddress()
postalAddress.street = "2300 College Ave"
postalAddress.city = "Berkeley"
postalAddress.state = "CA"
postalAddress.postalCode = "94108"
postalAddress.country = "United States"
let placemarks3 = try await geocoder.geocodePostalAddress(postalAddress)
XCTAssertTrue(placemarks3.count > 0, "Geocoder works and gets an placemark")
XCTAssertTrue(placemarks3.first?.postalCode == "94108", "Geocode placemark has right postal code")
} catch {
XCTFail("Geocoder failed: placemarks = \(error).") // get failure here, with error code 8 (
}
do {
let collegeAveString = "2300 College Ave, Berkeley, CA, 94704, United States"
let placemarksString = try await geocoder.geocodeAddressString(collegeAveString)
XCTAssertTrue(placemarksString.count > 0, "Geocoder works and gets an placemark")
XCTAssertTrue(placemarksString.first?.postalCode == "94704", "Geocode placemark has right postal code")
} catch {
XCTFail("Geocoder failed: placemark string = \(error).")
}
}
Would love any help regarding this.
I am getting sporadic reports from end-users about a crash in my SwiftUI view. This is what the symbolicated crash report looks like:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001ba42e84c __pthread_kill + 8
1 libsystem_pthread.dylib 0x00000001d6cfc9e8 pthread_kill + 212 (pthread.c:1392)
2 libsystem_c.dylib 0x00000001972688f4 abort + 100 (abort.c:110)
3 AttributeGraph 0x00000001b5d36c7c AG::precondition_failure(char const*, ...) + 188 (ag-util.cc:51)
4 AttributeGraph 0x00000001b5d1cb84 AG::data::table::grow_region() + 288 (ag-data.cc:67)
5 AttributeGraph 0x00000001b5d1ced0 AG::data::table::alloc_page(AG::data::zone&, unsigned int) + 588 (ag-data.cc:212)
6 AttributeGraph 0x00000001b5d1d268 AG::data::zone::alloc_slow(unsigned int, unsigned int) + 228 (ag-data.cc:339)
7 AttributeGraph 0x00000001b5d1d524 AG::data::zone::alloc_bytes_recycle(unsigned int, unsigned int) + 240 (ag-data.h:417)
8 AttributeGraph 0x00000001b5d1d3b8 AG::data::zone::realloc_bytes(AG::data::ptrvoid&, unsigned int, unsigned int, unsigned int) + 112 (ag-data.cc:387)
9 AttributeGraph 0x00000001b5d25b64 AG::data::vectorAG::OutputEdge::reserve_slow(AG::data::zone&, unsigned int) + 96 (ag-data-vector.h:191)
10 AttributeGraph 0x00000001b5d237d4 void AG::Graph::add_output_edgeAG::Node(AG::data::ptrAG::Node, AG::AttributeID) + 144 (ag-data-vector.h:172)
...
73 SwiftUI 0x0000000194f3287c closure #1 in ViewRendererHost.updateViewGraphA(body:) + 92 (ViewRendererHost.swift:92)
74 SwiftUI 0x0000000194f2b0b4 ViewRendererHost.updateViewGraphA(body:) + 88 (compiler-generated:0)
75 SwiftUI 0x0000000194f31328 ViewRendererHost.sizeThatFits(_:) + 112 (ViewRendererHost.swift:249)
76 SwiftUI 0x0000000195087980 _UIHostingView.sizeThatFits(_:) + 112 (UIHostingView.swift:1865)
77 SwiftUI 0x00000001950879c8 @objc _UIHostingView._baselineOffsets(at:) + 48
78 UIKitCore 0x0000000190b58bf8 -[UIView(_UIConstraintBasedLayoutEmbedding) _layoutSizeThatFits:fixedAxes:] + 84 (UIView_UnifiedLayout.m:27)
79 UIKitCore 0x00000001911f5214 -[UIView(UIConstraintBasedLayout) intrinsicContentSize] + 92 (NSLayoutConstraint_UIKitAdditions.m:2112)
86 CoreAutoLayout 0x00000001a2b73934 -[NSISEngine withBehaviors:performModifications:] + 80 (NSISEngine.m:1917)
87 UIKitCore 0x00000001911fea98 __100-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:]_block_invoke + 88 (NSLayoutConstraint_UIKitAdditions.m:4458)
88 UIKitCore 0x00000001911fd4bc -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] + 120 (NSLayoutConstraint_UIKitAdditions.m:4157)
89 UIKitCore 0x00000001911fe6e4 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:] + 160 (NSLayoutConstraint_UIKitAdditions.m:4457)
90 UIKitCore 0x00000001911ff6bc -[UIView(AdditionalLayoutSupport) _updateConstraintsAtEngineLevelIfNeededWithViewForVariableChangeNotifications:] + 428 (NSLayoutConstraint_UIKitAdditions.m:4722)
91 UIKitCore 0x00000001912cee00 -[UIView(Hierarchy) layoutBelowIfNeeded] + 860 (UIView.m:12277)
92 CJournal 0x00000001029e2894 MapCalloutView.setupView() + 948 (MapCalloutView.swift:80)
93 CJournal 0x00000001029e2aa0 specialized MapCalloutView.init(rootView:) + 320 (MapCalloutView.swift:43)
94 CJournal 0x0000000102a3b01c MapCalloutView.init(rootView:) + 8 (MapCalloutView.swift:0)
95 CJournal 0x0000000102a3b01c MapCalloutView.__allocating_init(rootView:) + 24 (CJMapsCalloutController.swift:19)
96 CJournal 0x0000000102a3b01c CJMapsCalloutController.makeMapsCalloutView() + 252
97 CJournal 0x0000000102a3b070 @objc CJMapsCalloutController.makeMapsCalloutView() + 28 (compiler-generated:0)
98 CJournal 0x00000001027cb2a8 -[CJCustomAnnotationView setupAnnotationDetailAccessoryViewWithAddress:] + 312 (CJCustomAnnotationView.m:114)
99 CJournal 0x00000001027cb154 -[CJCustomAnnotationView setupAnnotationForPersonAddress:] + 553300 (CJCustomAnnotationView.m:0)
100 CJournal 0x00000001027cb370 -[CJCustomAnnotationView setupAnnotationForClusterAnnotation:] + 553840 (CJCustomAnnotationView.m:0)
101 CJournal 0x00000001027cad70 -[CJCustomAnnotationView configureAnnotationViewWithAnnotation:] + 552304 (CJCustomAnnotationView.m:38)
102 CJournal 0x00000001027cacec -[CJCustomAnnotationView initWithAnnotation:reuseIdentifier:withDefaultColor:withCalloutDelegate:] + 552172 (CJCustomAnnotationView.m:32)
103 CJournal 0x0000000102884f74 -[MapViewShared annotationViewForMap:forAnnotation:withCalloutDelegate:] + 1314676 (MapViewShared.m:62)
I'm not displaying a complicated SwiftUI view ... it's not based on List or Form and doesn't have Navigation either, though it does use GeometryReader in some cases (which doesn't seem to be part of this stack trace). The SwiftUI view is shown as part of an MKAnnotationView's detailCalloutAccessoryView. I use a wrapper UIView in which there is a UIHostingController, which is what contains the SwiftUI view.
Would love any help or insight into this issue. Unfortunately I can't reproduce it on my end currently, so would be very helpful to get more details from the stack trace if possible.
I want to test my UNUserNotificationCenter authorization workflow for my MacOS app. I can't seem to find a way to reset the authorization status to notDetermined again. tccutil doesn't seem to contain any options for this. Any suggestions?
I have a couple of questions about NSSharingService, specifically with NSSharingServiceNameComposeEmail:1) I use [NSSharingService sharingServiceNamed:NSSharingServiceNameComposeMessage], then set the correct parameters and call `performWithItems` on it. This works fine if the Mail app is configured to be the "Default email reader" in Mail.app's Preferences. If I change this to some of the other email clients I have, this doesn't work anymore. I have tried MS Outlook, Airmail and Unibox apps, and this doesn't work in any of them. Is this intentional? Does the sharing service with NSSharingServiceNameComposeMessage only work for Mail.app?2) If that isn't the case, and other apps can be responsible for composing emails as well, what does an app have to do to handle this? If I want to set myself as an email client app, and let others call ComposeMessage, what API should I implement? If anyone has an idea on how to do this, would really appreciate the help.Thanks.
Hi,
I have been using the BackgroundTasks API on iOS for a while, and it works great. I want to do something similar on macOS, where I can easily run some background process from my app every X minutes, even if the app is closed. My Mac app runs in the sandbox, and isn't Catalyst-based, so I can't run the UIKit 'BackgroundTasks' API, and I haven't found anything similar on macOS. Does something like that exist, that is easy to adopt?
Hi,
I have a paid macOS app available in the Mac App Store for the past few years, and I'm looking into converting it into a freemium app. I wanted to add a check to see if the app was purchased legitimately or not, since I know there's a lot of pirated copies available on the internet.
I just did some basic analytics with the app already on the store, the app receipt validation fails because there's no file found at the receipt URL location. I'm just doing this basic check and it fails for a lot of the cases ....
NSURL *receiptURL = [NSBundle mainBundle].appStoreReceiptURL;
BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:receiptURL.path isDirectory:nil];
Does this signify that the user has a non-AppStore copy of the app? Or could the receipt be missing for other legitimate reasons? Do I have to make a call to refresh the receipt to confirm this (as I would on iOS)?
Again, this is for an existing app on the Mac App Store, not testing for sandbox users.
Thanks.
Topic:
App & System Services
SubTopic:
Core OS
Tags:
macOS
Mac App Store
App Store Receipts
StoreKit
Hi,
I plan to use the new AppTransaction.shared API in StoreKit2 to find the user's original purchase date and version for my macOS app. However, when testing this running in the debugger, the app shows up with an App Store login prompt, asking for my login and password, which is undesirable. I wanted to know if this is just a sandbox quirk, or is the "AppTransaction.shared" API supposed to trigger this prompt for all users, even in production? In that case, is it like the old "Refresh receipt" API where we shouldn't trigger this automatically when a user opens the app, and instead have a button somewhere that triggers the call?
Thanks.