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.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
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.
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 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'.
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.
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.
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 - <date> - 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.
Hi,
I am trying to build my project with Xcode12, and I am running into this error:
<unknown>: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
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?
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,
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.
I want to add a NSDatePicker in the sidebar of my app, to help select a date , or a range of dates. I could use the standard NSDatePicker, but it only seems to come in a single size, and doesn't seem to be resizable. I've dropped the NSDatePicker component into a xib file, and added auto-layout constraints, but they don't seem to work. Is there a way to make them respond to auto-layout and be resizable? Or should I be looking for 3rd-party frameworks to integrate with (if so, any recommendations)?
Hi,
In my Core Data schema, I have a 'transformable' attribute in an entity, which is using a custom NSValueTransformer, the purpose of which is to convert a UIImage into NSData with some compression (basically to save a small thumbnail from the image). From this attribute, I had recently started getting these warnings about using NSKeyedUnarchiveFromData:
'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release
So I read about this, and figured I'd need to change the NSValueTransformer to using NSSecureUnarchiveFromDataTransformer ... but after making the changes (as best as I understood them) I can't get it to work, and now the app crashes when the attribute is accessed.
This is the existing NSValueTransformer that I was using:
@interface ImageToDataTransformer : NSValueTransformer {
}
@implementation ImageToDataTransformer (BOOL)allowsReverseTransformation {
return YES;
}
(Class)transformedValueClass {
return [NSData class];
}
(id)transformedValue:(id)value {
// for our smaller views this uses much less data and makes for faster syncing
NSData *compressedData = UIImageJPEGRepresentation(value, 0.2);
return compressedData;
}
(id)reverseTransformedValue:(id)value {
UIImage *uiImage = [[UIImage alloc] initWithData:value];
NSData *data = (NSData *) value;
//NSLog(@"reverseTransformedValue: image size: %@", [NSByteCountFormatter stringFromByteCount:data.length countStyle:NSByteCountFormatterCountStyleFile]);
return uiImage;
}
So I changed it to subclass from NSSecureUnarchiveFromDataTransformer instead, and added the following to the implementation:
(NSArrayClass *)allowedTopLevelClasses {
return @[[ImageToDataTransformer class]];
}
(void)setValueTransformer:(nullable NSValueTransformer *)transformer forName:(NSValueTransformerName)name {
NSLog(@"ImageToDataTransfer: calling setValueTransformer");
[NSValueTransformer setValueTransformer:transformer forName:name];
}
(NSArrayNSValueTransformerName *)valueTransformerNames {
return @[@"ImageToDataTransformerName"];
}
Before the Core Data persistent store is accessed, I 'register' the transformer:
[ImageToDataTransformer setValueTransformer: [[ImageToDataTransformer alloc] init] forName:@"ImageToDataTransformerName"];
Now the app crashes when the image is read:
[__NSCFData _rasterizedImage]: unrecognized selector sent to instance 0x7ff53c108800
If I change the transformer back to NSValueTransformer, it works fine. So I'm not sure if I'm missing something from the implementation, or I have misunderstood the premise of 'NSSecureUnarchiveFromDataTransformer'. Would love to know what I can do to fix this.
Hi,
I have an 'uploader' function in my app that can populate the CloudKit private database with a lot of user data. I batch the records into multiple CKModifyRecordsOperations, across the different record types, before I upload them. When I do this with a lot of data, I sometimes get CKErrorRequestRateLimited errors, with a value for CKErrorRetryAfterKey specified in the CKError, for a few of the modify operations. I usually respond by creating new operations for the same records, delaying them by the specified CKErrorRetryAfterKey key, and then retrying the operations. But those operations end up getting more errors with CKErrorServiceUnavailable or CKErrorRequestRateLimited again.
So my question is .... is the CKErrorRetryAfterKey value supposed to be cumulative, and does it apply across operations? For e.g. if I have Operations 1, 2 and 3, and each of them returns with a 'retry' error value (say 5, 10, and 15 seconds) ... can I retry them with the retry values for each operation (5 secs for Op1 etc), or should I choose the highest retry value before trying another operation (15 secs), or should I add them up and not try anything for the sum of their retry values (30 secs)? And is this ‘retry’ value limited to each record type, or is it generally for the whole container?
If anyone has an insight into this, I would love to know.
Thanks,
Zulfi Shah.
I am having a hard time uploading data to my CloudKit container in a series of operations. I have an 'uploader' function in my app that can populate the CloudKit private database with a lot of user data. I batch the records into multiple CKModifyRecordsOperations (with 300 records in each operation as a maximum), before I upload them. When I do this with a lot of data (less than 50MB even), I get CKErrorRequestRateLimited errors for some of the operations, with a value for CKErrorRetryAfterKey specified in the CKError. I respond by creating new operations for the same records, delaying them by the specified CKErrorRetryAfterKey key, and then retrying the operations. But those operations end up getting more CKErrorRequestRateLimited errors again. Usually one or two operations go through at a time, and all others have the same error, and then I have to retry again after 90 seconds or whatever the retry-key says. Doing all of this can take dozens of minutes to do a simple upload.
I checked the CloudKit dashboard, and for the container's 'developer' telemetry section, the 'server latency' seems very very high (over 100,000 for 95% percentile). It also suggests the 'average request size' is 150KB on average across the last few days as I've been testing this, which doesn't seem like a lot.
I've tried throttling the requests so only 20 modify operations are sent at a time, but it doesn't seem to help. I'm not sure what else I can try to improve this. I have 'query' indexes for 'recordName' field for each recordType, and 'query, searchable, sortable' on some of the custom fields on the recordTypes (though not all). The CKModifyRecordsOperations' configurations have 'qualityOfService' set to 'userInitiated'.
Is there anything else I can try to improve the upload speeds? Or is it out of my control?