Post

Replies

Boosts

Views

Created

SwiftUI crash with "AttributedGraph": AG::precondition_failure(char const*, ...) ()
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.
2
1
2.3k
May ’21
Core Data - do we need to add model versions?
Hi, I've been working with Core Data for a number of years, and I remember that when I needed to add attributes or entities to the data model, I had to first create a new model version, then add the new attributes/entities, and then use the "lightweight migration' flag when adding the NSPersistentStore to the NSPersistentStoreCoordinator. If it didn't add the new model version, the app would crash. I've tried adding something to my data model now after a few years, without adding a new model version in Xcode. And right now, it seems to work fine. I can read/write to the new attribute that I added to an entity, and nothing crashed. I tried this on the simulator, as well as on my device. Did something change at some point, where adding a new model version isn't a requirement for using lightweight migration? Or am I missing something? Why isn't it crashing anymore (and will it crash if I change my model without adding a new model version and ship it to production)? Thanks.
1
0
1.7k
Mar ’21
Warnings in NSCollectionView referencing UICollectionViewFlowLayout
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) { &#9; 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.
2
0
2.8k
Dec ’20
'NSWidgetWantsLocation' key prompts for location
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.
1
0
888
Oct ’20
Volume purchasing with In-app purchases
Hi, My app is free-to-download but with an in-app purchase to unlock all the features. A user wants to buy 15 copies of the "unlock" IAP and distribute it to his team, using MDM to distribute it easily. I don't believe there is a way to do this through business purchases, is that right? You can only download apps through MDM but not in-app purchases. So what's the best way to do this? Are there any standard solutions? Can I upload a new version of the app that's "paid up-front" but not available through the regular App Store, but only through MDM?
2
0
5.0k
Sep ’20
Xcode12 error: module compiled with Swift 5.2.4 cannot be imported by the Swift 5.3 compiler
Hi, I am trying to build my project with Xcode12, and I am running into this error: &lt;unknown&gt;:0: error: module compiled with Swift 5.2.4 cannot be imported by the Swift 5.3 compiler: /Users/zs/Documents/CJ/branches/CJ-400/SimpleList/Carthage/Build/iOS/PhoneNumberKit.framework/Modules/PhoneNumberKit.swiftmodule/x86_64-apple-ios-simulator.swiftmodule Not sure how to resolve this. I've tried: cleaning the build directory and building again cleaning build dir, plus deleting DerivedData, and restarting Xcode and building again running 'carthage update PhoneNumberKit --platform iOS', and doing another clean build changing the Xcode command-line tool to Xcode 12, and building again None of these have worked. What else can I try? Why am I getting this error? Would love some more information
10
0
23k
Jul ’20
Xcode Build Timing summary not visible
HiI'm trying to use Xcode's "Build With Timing Summary" feature. It kicks off a build, and I can see the new build in the Build Reports navigator, but when I look through All Messages in the build results, there is "Timing Summary" information. It just says "Build Success - &lt;date&gt; - 75 seconds", but there isn't a breakdown of the timing results.My target builds an iOS app with many extensions, so I can't post the whole logs here. But is there any reason why I can't find the timing results? I do have that older Xcode flag 'ShowBuildOperationDuration' which still works, but only gives the same overall build summary time, not a breakdown.
2
2
3.8k
Apr ’20
iOS13: Display name in share sheet with multiple share extensions
Hi,My app supports 2 different share extensions, and before iOS13, it was easy to tell them apart, because I would specify this in the Bundle Display Name (CFBundleDisplayName in info.plist). With iOS13, it seems to only show the name of the app for both share extensions, and not the Display Name specified, which will make it confusing to users if they see the same app icon + name in the share sheet.I filed a Radar for this, but it was returned with "Resolution:Investigation complete - Change required from 3rd party" ... but it didn't specify what kind of change to make.Anyone know how to customize the name of the share extension going forward?Thanks.
5
0
2.9k
Sep ’19
Why do we need receipt validation for IAP?
Hi,I'm starting to work on adding a auto-renewable subscription in my app to unlock certain features. I understand the StoreKit and iTC details, but one thing that's not clear to me is *why* we need to do receipt validation for in-app purchases? There seems to be a lot of empasis on doing this, and it gets complicated because you need to either import different libraries to do this client-side (which isn't the recommended option) or do it server-side, which adds a lot of overhead. In my case, I don't have any server running at all, and my whole app relies on CloudKit instead. So I'm wondering why it's so essential in case of IAP. a) if it's for preventing piracy, shouldn't that apply to paid-apps as well? But no one talks about reciept validation for paid-up-front apps.b) when StoreKit's paymentQueue "updatedTransactions" delegate tells us that someone has purchased an IAP, is that something that can be spoofed? I would imagine not, and even so, this would only be possible with jailbroken devices. Is that what people are worried about? How much of a problem is this in the real world? c) is there certain information in the reciept that is essential for subscriptions to work correctly? In my mind, the simplest implementation would be this: display the IAP products, implement the storekit delegate to see when the user purchased the product and mark that user's CloudKit "User" record with the type and date of subscription (this can also be used to restore the IAP on another device) and unlock the features. When the next billing cycle comes, I can wait for StoreKit to tell me whether the user cancelled or continued the subscription, and lock/unlock the feature accordingly. I don't see the necessity of receipt validation in this case. But I might be wrong and misguided about my assumptions. Would love some comments about this.
15
2
12k
Mar ’18
Setting CKRecord's recordChangeTag field for unit testing
Hi,I am rrying to add unit tests for my CloudKit error handling code. One of my tests requires me to set the 'recordChangeTag' property to something that's not nil (so it can simulate an existing server record) ... but I can't figure out a way how to set this. Setting a value using the record.recordChangeTag doesn't work, wont even compile. I tried using [record setObject: @"aad" forKey:@"recordChangeTag"]; but even that fails at run-time, failing with this:"caught "NSInvalidArgumentException", ""recordChangeTag" is a reserved key name"Is there any other way to set this? I need to test some conflict-handling code, and the only way to do this sensibly is to simulate an existing server record, which you can't do without a 'recordChangeTag'.
1
0
962
Oct ’17
NSSharingService with email for 3rd-party apps
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.
Topic: UI Frameworks SubTopic: AppKit Tags:
3
1
2.3k
Aug ’16
CloudKit subscriptions for public databases
I'm deliberating on whether to use CloudKit for an app that requires sharing data amongst self-created groups of users (for e.g. sharing company-wide directories). I would use a public database for this, but I had a couple of questions:- if I create a subscription to listen to record changes for a partcular record type, will all the users get a notification when data changes, or only the logged-in iCloud user amongst his/her multiple devices? can there by 'group' notifications that cross iCloud users?- if there's no way for a 'group' of users to get notifications, I guess polling from the app to CloudKit would work, with the groupID part of the predicate? Or is there another options?Thanks.
8
0
4.0k
Dec ’15
CNContact identifiers
Hi,I saw the WWDC talk on the new Contacts framework, and I had a couple of questions about the identifier property:When users upgrade from iOS8 to iOS9, will their old AddressBook recordIDs still work if we are using the AddressBook framework in the app (i.e. haven't upgraded to using Contacts framework)?Are the new CNContact identifiers consistent across iOS and Mac devices? i.e. if we have the identifier on one device, we can lookup the contact on another device with the same identifier?Can these identifiers change in the lifetime of that contact? This was a problem with AddressBook recordIDs ... if you removed the account and then synced it back again, all the contacts would get a different identifier. Same with restoring the device. Will the CNGroup and CNContainer identifiers also be consistent across devices?Hope someone in the Apple Contacts frameworks team can answer. Thanks.
6
0
4.7k
Jun ’15
SwiftUI crash with "AttributedGraph": AG::precondition_failure(char const*, ...) ()
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&amp;, 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&amp;, unsigned int, unsigned int, unsigned int) + 112 (ag-data.cc:387) 9 AttributeGraph 0x00000001b5d25b64 AG::data::vectorAG::OutputEdge::reserve_slow(AG::data::zone&amp;, 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.
Replies
2
Boosts
1
Views
2.3k
Activity
May ’21
Core Data - do we need to add model versions?
Hi, I've been working with Core Data for a number of years, and I remember that when I needed to add attributes or entities to the data model, I had to first create a new model version, then add the new attributes/entities, and then use the "lightweight migration' flag when adding the NSPersistentStore to the NSPersistentStoreCoordinator. If it didn't add the new model version, the app would crash. I've tried adding something to my data model now after a few years, without adding a new model version in Xcode. And right now, it seems to work fine. I can read/write to the new attribute that I added to an entity, and nothing crashed. I tried this on the simulator, as well as on my device. Did something change at some point, where adding a new model version isn't a requirement for using lightweight migration? Or am I missing something? Why isn't it crashing anymore (and will it crash if I change my model without adding a new model version and ship it to production)? Thanks.
Replies
1
Boosts
0
Views
1.7k
Activity
Mar ’21
Warnings in NSCollectionView referencing UICollectionViewFlowLayout
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) { &#9; 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.
Replies
2
Boosts
0
Views
2.8k
Activity
Dec ’20
'NSWidgetWantsLocation' key prompts for location
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.
Replies
1
Boosts
0
Views
888
Activity
Oct ’20
Volume purchasing with In-app purchases
Hi, My app is free-to-download but with an in-app purchase to unlock all the features. A user wants to buy 15 copies of the "unlock" IAP and distribute it to his team, using MDM to distribute it easily. I don't believe there is a way to do this through business purchases, is that right? You can only download apps through MDM but not in-app purchases. So what's the best way to do this? Are there any standard solutions? Can I upload a new version of the app that's "paid up-front" but not available through the regular App Store, but only through MDM?
Replies
2
Boosts
0
Views
5.0k
Activity
Sep ’20
Xcode12 error: module compiled with Swift 5.2.4 cannot be imported by the Swift 5.3 compiler
Hi, I am trying to build my project with Xcode12, and I am running into this error: &lt;unknown&gt;:0: error: module compiled with Swift 5.2.4 cannot be imported by the Swift 5.3 compiler: /Users/zs/Documents/CJ/branches/CJ-400/SimpleList/Carthage/Build/iOS/PhoneNumberKit.framework/Modules/PhoneNumberKit.swiftmodule/x86_64-apple-ios-simulator.swiftmodule Not sure how to resolve this. I've tried: cleaning the build directory and building again cleaning build dir, plus deleting DerivedData, and restarting Xcode and building again running 'carthage update PhoneNumberKit --platform iOS', and doing another clean build changing the Xcode command-line tool to Xcode 12, and building again None of these have worked. What else can I try? Why am I getting this error? Would love some more information
Replies
10
Boosts
0
Views
23k
Activity
Jul ’20
Xcode Build Timing summary not visible
HiI'm trying to use Xcode's "Build With Timing Summary" feature. It kicks off a build, and I can see the new build in the Build Reports navigator, but when I look through All Messages in the build results, there is "Timing Summary" information. It just says "Build Success - &lt;date&gt; - 75 seconds", but there isn't a breakdown of the timing results.My target builds an iOS app with many extensions, so I can't post the whole logs here. But is there any reason why I can't find the timing results? I do have that older Xcode flag 'ShowBuildOperationDuration' which still works, but only gives the same overall build summary time, not a breakdown.
Replies
2
Boosts
2
Views
3.8k
Activity
Apr ’20
iOS13: Display name in share sheet with multiple share extensions
Hi,My app supports 2 different share extensions, and before iOS13, it was easy to tell them apart, because I would specify this in the Bundle Display Name (CFBundleDisplayName in info.plist). With iOS13, it seems to only show the name of the app for both share extensions, and not the Display Name specified, which will make it confusing to users if they see the same app icon + name in the share sheet.I filed a Radar for this, but it was returned with "Resolution:Investigation complete - Change required from 3rd party" ... but it didn't specify what kind of change to make.Anyone know how to customize the name of the share extension going forward?Thanks.
Replies
5
Boosts
0
Views
2.9k
Activity
Sep ’19
Why do we need receipt validation for IAP?
Hi,I'm starting to work on adding a auto-renewable subscription in my app to unlock certain features. I understand the StoreKit and iTC details, but one thing that's not clear to me is *why* we need to do receipt validation for in-app purchases? There seems to be a lot of empasis on doing this, and it gets complicated because you need to either import different libraries to do this client-side (which isn't the recommended option) or do it server-side, which adds a lot of overhead. In my case, I don't have any server running at all, and my whole app relies on CloudKit instead. So I'm wondering why it's so essential in case of IAP. a) if it's for preventing piracy, shouldn't that apply to paid-apps as well? But no one talks about reciept validation for paid-up-front apps.b) when StoreKit's paymentQueue "updatedTransactions" delegate tells us that someone has purchased an IAP, is that something that can be spoofed? I would imagine not, and even so, this would only be possible with jailbroken devices. Is that what people are worried about? How much of a problem is this in the real world? c) is there certain information in the reciept that is essential for subscriptions to work correctly? In my mind, the simplest implementation would be this: display the IAP products, implement the storekit delegate to see when the user purchased the product and mark that user's CloudKit "User" record with the type and date of subscription (this can also be used to restore the IAP on another device) and unlock the features. When the next billing cycle comes, I can wait for StoreKit to tell me whether the user cancelled or continued the subscription, and lock/unlock the feature accordingly. I don't see the necessity of receipt validation in this case. But I might be wrong and misguided about my assumptions. Would love some comments about this.
Replies
15
Boosts
2
Views
12k
Activity
Mar ’18
Setting CKRecord's recordChangeTag field for unit testing
Hi,I am rrying to add unit tests for my CloudKit error handling code. One of my tests requires me to set the 'recordChangeTag' property to something that's not nil (so it can simulate an existing server record) ... but I can't figure out a way how to set this. Setting a value using the record.recordChangeTag doesn't work, wont even compile. I tried using [record setObject: @"aad" forKey:@"recordChangeTag"]; but even that fails at run-time, failing with this:"caught "NSInvalidArgumentException", ""recordChangeTag" is a reserved key name"Is there any other way to set this? I need to test some conflict-handling code, and the only way to do this sensibly is to simulate an existing server record, which you can't do without a 'recordChangeTag'.
Replies
1
Boosts
0
Views
962
Activity
Oct ’17
NSSharingService with email for 3rd-party apps
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.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
3
Boosts
1
Views
2.3k
Activity
Aug ’16
CloudKit subscriptions for public databases
I'm deliberating on whether to use CloudKit for an app that requires sharing data amongst self-created groups of users (for e.g. sharing company-wide directories). I would use a public database for this, but I had a couple of questions:- if I create a subscription to listen to record changes for a partcular record type, will all the users get a notification when data changes, or only the logged-in iCloud user amongst his/her multiple devices? can there by 'group' notifications that cross iCloud users?- if there's no way for a 'group' of users to get notifications, I guess polling from the app to CloudKit would work, with the groupID part of the predicate? Or is there another options?Thanks.
Replies
8
Boosts
0
Views
4.0k
Activity
Dec ’15
CNContact identifiers
Hi,I saw the WWDC talk on the new Contacts framework, and I had a couple of questions about the identifier property:When users upgrade from iOS8 to iOS9, will their old AddressBook recordIDs still work if we are using the AddressBook framework in the app (i.e. haven't upgraded to using Contacts framework)?Are the new CNContact identifiers consistent across iOS and Mac devices? i.e. if we have the identifier on one device, we can lookup the contact on another device with the same identifier?Can these identifiers change in the lifetime of that contact? This was a problem with AddressBook recordIDs ... if you removed the account and then synced it back again, all the contacts would get a different identifier. Same with restoring the device. Will the CNGroup and CNContainer identifiers also be consistent across devices?Hope someone in the Apple Contacts frameworks team can answer. Thanks.
Replies
6
Boosts
0
Views
4.7k
Activity
Jun ’15