Post

Replies

Boosts

Views

Activity

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.3k
Jun ’15
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
3.6k
Dec ’15
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.
3
1
2.1k
Aug ’16
NSAsynchronousFetchRequest and concurrency violations
Is there any particular reason why the Core Data concurrency debug flag throws an exception when using NSAsynchronousFetchRequest? It semes to be happening in both iOS10 and iOS11. This is the code I was testing:- (void) testAsync { NSManagedObjectContext *spotlightMOC = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType]; spotlightMOC.name = @"BackgroundMOC"; NSPersistentStoreCoordinator *psc = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:self.managedObjectModel]; [psc addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:self.persistentStoreCoordinator.persistentStores.firstObject.URL options:@{NSReadOnlyPersistentStoreOption: @YES, NSMigratePersistentStoresAutomaticallyOption: @YES, NSInferMappingModelAutomaticallyOption: @NO} error:nil]; [spotlightMOC setPersistentStoreCoordinator: psc]; NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName: @"Person"]; NSAsynchronousFetchRequest *asynchronousFetchRequest = [[NSAsynchronousFetchRequest alloc] initWithFetchRequest:fetchRequest completionBlock:^(NSAsynchronousFetchResult *result) { if (!result.operationError) { NSLog(@"processAsyncResult count = %lu", (unsigned long) result.finalResult.count); NSLog(@"print = %@", result.finalResult); } }]; [spotlightMOC performBlock:^{ NSError *asynchronousFetchRequestError = nil; / [spotlightMOC executeRequest:asynchronousFetchRequest error:&asynchronousFetchRequestError]; if (asynchronousFetchRequestError) { NSLog(@"Unable to execute asynchronous fetch result."); NSLog(@"%@, %@", asynchronousFetchRequestError, asynchronousFetchRequestError.localizedDescription); } else { NSLog(@"AsyncRequest executeRequest finised without error"); } }]; }With the -com.apple.CoreData.ConcurrencyDebug flag set to 1 in "Arguments Passed On Launch", I always hit an exception that says "CoreData`+[NSManagedObjectContext __Multithreading_Violation_AllThatIsLeftToUsIsHonor__]:"What concurrency violation am I committing here? Or is this a bug with Xcode / Core Data?
1
1
806
Jul ’17
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
824
Oct ’17
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
11k
Mar ’18
Multiple custom intents
What's the recommendation when working with multiple custom intents per target? Should we make separate Intents Extensions for each? Or one extension, but with separate Intents Definition files? Or can we create multiple custom intents from the same IntentsDefinition file? I am trying to use this in iOS13 Beta2 (with custom parameters). I was able to create multiple intents in the same file, but when donating the 2nd intent, I get a random error about "Cannot donate interaction with MySecondIntent that has no valid shortcut types"
3
0
1.7k
Jun ’19
Removing boiler-plate for auto-renewable subscriptions
I read somewhere around WWDC that we can now remove the legal boilerplate content from the page where we sell auto-renewing subscriptions from the app. Does anyone know if you can also remove the same from the App Store "Description" field? I can't find any link or article that confirms this. By boiler-plate, I mean .."subscriptions will automatically renew unless canceled within 24 hours before the end of the current period ... " and all that required text.
1
0
655
Jul ’19
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.6k
Sep ’19
NSMetadataQuery not working in Catalina
Hi,I have been NSMetadataQuery to monitor the Documents folder of my app to pick up new files that were added. This stopped working in Catalina. Is this a documented issue or change in functionality? Is there any new security permission or privacy thing that I have to enable in my app to continue monitoring the local Documents folder from my own app?This is the code I was using the setup folder monitoring (which works fine in Mojave ... but not in Catalina):self.metadataQuery = [[NSMetadataQuery alloc] init]; [self.metadataQuery setSearchScopes:@[dropLocation.path]]; [self.metadataQuery setPredicate:[NSPredicate predicateWithFormat:@"%K LIKE '*.eml'", NSMetadataItemFSNameKey]]; [[NSNotificationCenter defaultCenter] addObserverForName:NSMetadataQueryDidFinishGatheringNotification object:self.metadataQuery queue:nil usingBlock:^(NSNotification *note) { // do nothing ... not sure why it's required NSLog(@"NSMetadataQueryDidFinishGatheringNotification called"); }]; [[NSNotificationCenter defaultCenter] addObserverForName:NSMetadataQueryDidUpdateNotification object:self.metadataQuery queue:nil usingBlock:^(NSNotification *note) { NSLog(@"NSMetadataQueryDidUpdateNotification called"); [self processResultsForQueryWithStartDate: date]; }]; [self.metadataQuery startQuery];
5
0
1.1k
Dec ’19
Problem using Swift with Objective-C framework
I have an old Objective-C project, which has multiple targets, and some of the targets share a framework (let's call it CJDataKit) that's also written in Objective-C. I'm trying to add some Swift code to my project, at least to the main app target, and have some limited implementation of it working, but I'm running into some issues whenever the Swift code needs to use or import the CJDataKit framework, or any header file that itself imports the CJDataKit framework.What's WorkingI wrote a basic UIView subclass in Swift (which didn't need any other code from my app), and I can use this in my Objective-C target, using @objc keyword and by importing "MyApp-Swift.h" in my Objective-C code.I then wrote a new UIViewController subclass in Swift, and used a couple of simple Objective-C objects from both CJDataKit framework and non-framework classes. I did this by creating a bridging header file, and added the Objective-C headers there.So far so good, and everything compiles fine.What's Not WorkingThe problem happens if I try to import into Swift other Objective-C files that might be importing the CJDataKit framework inside it. For e.g. I wanted to write a Swift extension of an existing UIViewController subclass (call is PageAViewController). This PageAViewController imports multiple other header files. If I add it to the bridging header file, I start getting build errors: Include of non-modular header inside framework module 'CJDataKit': '.../CJDataKit/Person.h' Commenting out the@import CJDataKit makes it work for this particular file, but it still gets compile errors from a different header file (that was imported by PageAViewController). It only seems to work if all the files listed in the bridging-header file don't have a @import CJDataKit, which is difficult and cumbersome. So something about Swift doesn't like interacting with the CJDataKit framework directly. I've also tried importing the CJDataKit.h header file into the Swift bridging header file, figuring this way I don't have to individually import each file from the framework, but that doesn't work either. That results in a different error:Could not build module 'CJDataKit.h'I've tried using #import <CJDataKit/CJDataKit.h> as well but same result. From my settings:- "Allow Non-modular Includes In Framework Modules" is Yes on the target, and framework. It is No at the project-level.- "Defines Module" is also set to Yes, on both the app target and framework, and No at project-level.Would love some help in getting this setup correctly. I've been searching for a solution, but haven't really found anything.
1
0
2.2k
Dec ’19
Adding index without model migration
I have an app that's been in the App Store for a while, using Core Data to save information. In my Core Data model, I have an entity that I haven't ever used till now, and I am planning to add an index on a property in this entiity, and with this update, start to also add data to this entity. This is the only change I plan to make right now, and I believe this will not trigger any automatic lightweight migration (which I want to avoid). So my question is: without the lightweight migration, will the new index even be created? I'm confused because this could result in two scenarios: either an index is created but existing data isn't indexed (which is just fine by me), or an index isn't created at all till a lightweight migration happens (which is undesirable). Would be great to know what the expected behavior is in this case.
0
0
331
Dec ’19
CloudKit notifications not being received on iOS device
I have an app on the App Store that works with CloudKit, and remote notifications work just fine there. If a user modifies a record, it triggers a push notification on his/her other devices, and AppDelegate's didReceiveRemoteNotification is called.In the dev environment, I've added some new entities, but in my testing, the push notifications aren't being received anymore. Basically didReceiveRemoteNotification isn't being called at all.Some important notes:this only doesn't work on iOS ... on my Mac app, pointing to the same CloudKit container, the remote notifications are received correctly, so it's nothing to do with how the CloudKit subscription is created or modified (I haven't changed anything in that regards anyways)I do call registerForRemoteNotifications as before, and didRegisterForRemoteNotificationsWithDeviceToken is called as expectedI am testing on a device, not a simulatorBackground App Refresh is enabled on the deviceNotifications are allowed for the appThe CKNotificationInfo object is created with shouldSendContentAvailable = YES, and alertBody = @"" (not a nil string)I dug into the device's console logs, using Xcode, and found that the console does output something that suggests that the device is receiving the push notification, but it's not being passed onto the app for some reason:default 18:02:47.127117 -0800 SpringBoard Received incoming message on topic com.apple.icloud-container.com.ztest.myapp at priority 10 default 18:02:47.133708 -0800 SpringBoard [com.ztest.myapp] Received remote notification request 0E01-5E4D [ waking: 0, hasAlertContent: 0, hasSound: 0 hasBadge: 0 hasContentAvailable: 1 hasMutableContent: 0 pushType: Alert] default 18:02:47.133780 -0800 SpringBoard [com.ztest.myapp] Process delivery of push notification 0E01-5E4D error 18:02:47.133851 -0800 SpringBoard [com.ztest.myapp] NOT requesting DUET deliver content-availateston-notifiying push notification 0E01-5E4D [pushType: Alert willNotifyUser: 0] error 18:02:47.133997 -0800 SpringBoard [com.ztest.myapp] NOT delivering non-notifying push notification 0E01-5E4D [pushType: Alert willNotifyUser: 0] default 18:02:47.134053 -0800 SpringBoard Getting effectiveSectionInfo for section identifier: com.zsquare.ijournal default 18:02:47.134099 -0800 SpringBoard [com.ztest.myapp] Getting effective section info default 18:02:47.135743 -0800 SpringBoard [com.ztest.myapp] Got effective section info [ hasResult: 1 ]I'm not really sure, but it seems like the one line here that shows 'error' with "NOT delivering non-notifying push notification" would explain the problem. But I'm not sure what is causing this. Could it just be the dev environment being flaky? I've tried this on multiple iOS devices now, so it's not just a problem with this one device.Can anyone suggest any reasons why the push notification isn't being received in the app, or suggest some way to test this and narrow down what's happening?Thanks.
7
0
3.4k
Feb ’20
Can't switch between MKMapTypeStandard and MKMapTypeMutedStandard types
I have a MKMapView in my app, and I want the user to be able to switch the map type, so it can be either MutedStandard, Standard, Satellite or Hybrid. I've hooked up a UISegmentedControl on the Map view controller to change the map types. The problem is, as I try to switch between MutedStandard and Standard (or vice versa), the map view never updates! It works fine for every other type change ... and it works if I quit and reload the app, but the real-time map type change never works if it's just between MutedStandard and Standard.The other strange thing is that it works fine on iOS12 ... just not on iOS13.Here is the simple code that handles this:- (IBAction) updateMapTypeSegmentControlValueChanged:(id)sender { [[NSUserDefaults standardUserDefaults] setInteger:self.segmentMapType.selectedSegmentIndex forKey:MapViewSettingsDisplayType]; [self updateMapDisplayType]; } - (void) updateMapDisplayType { NSUInteger mapType = [[NSUserDefaults standardUserDefaults] integerForKey: MapViewSettingsDisplayType]; switch (mapType) { case 0: { NSLog(@"MapView: updateMapDisplayType - setting to Muted"); self.mapView.mapType = MKMapTypeMutedStandard; break; } case 1: { NSLog(@"MapView: updateMapDisplayType - setting to Standard"); self.mapView.mapType = MKMapTypeStandard; break; } case 2: { NSLog(@"MapView: updateMapDisplayType - setting to Satellite"); self.mapView.mapType = MKMapTypeSatellite; break; } case 3: { NSLog(@"MapView: updateMapDisplayType - setting to Hybrid"); self.mapView.mapType = MKMapTypeHybrid; break; } default: { self.mapView.mapType = MKMapTypeMutedStandard; break; } } }Seems simple enough, but doesn't work on iOS13. I've tried using dispatch_after to make it change the type after 1 second, but that didn't work. Also tried calling [mapView setNeedsDisplay]after changing the map type, but that didn't help either. Any ideas of what I can try to make this work?
1
0
431
Apr ’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 - <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.
2
2
3.0k
Apr ’20