Post

Replies

Boosts

Views

Activity

Reply to NSMetadataQuery not working in Catalina
To be clear, the folder is the 'documents' folder from my own app's container:/Users/<username>/Library/Containers/com.myapp.macapp/Data/DocumentsIs this folder also protected now? I saw the linked video, but it wasn't clear what was new in this regard, or what I would need to do to fix this. Again, I'm using NSMetadataQuery to monitor this folder for changes. When building my app in Xcode, in 'Signing & Capabilities', I already have the "User Selected Files" permission selected with Read/Write, though not the others (Downloads, Pictures, Music, Movies).
Dec ’19
Reply to Using SKReceiptRefreshRequest in background task
Thanks for the response. I want to figure out a way where I can process a autorenewing subscription in the background, since some of my features aren't in the app itself but work though Shortcuts and Share Extensions. The user can go days without opening my app, so the subscription might have expired in the meantime. I figure that with BGAppRefreshTaskRequest there is some possibility of being able to refresh the receipt. From what little I've read, it seems that for production accounts, the receipt is always present (or at least if one transaction has been processed), so SKReceiptRefreshRequest wouldn't need to prompt the user to login to their App Store account. Is that information incorrect? Are there particular circumstances when a user is prompted to login to the App Store, or is it random / unknowable?
May ’20
Reply to UITableViewDiffableDataSource: example in Objective-C
Thanks for the reply. I'm confused about how to setup the UIDiffableDataSource object. I can setup the cellProvide first: UITableViewDiffableDataSourceCellProvider cellProvider = ^UITableViewCell*(UITableView * tableView, NSIndexPath *indexPath, NSDictionary *itemDictionary) {             CJSiriShortcutsSettingsTableViewCell *cell = (CJSiriShortcutsSettingsTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"ShortcutsCellIdentifier" forIndexPath:indexPath]; /// ... setup the cell here } Then I want to setup the datasource object, and I'm wondering if this is the right way to do it:         UITableViewDiffableDataSource <SiriShortcutsSection, NSDictionary *> *dataSource = [[UITableViewDiffableDataSource alloc] initWithTableView:self.tableView cellProvider:cellProvider];         self.tableView.dataSource = dataSource; The 'SiriShortcutsSection' is a enum: typedef enum : NSUInteger {     SiriShortcutsSectionExisting,     SiriShortcutsSectionAdd } SiriShortcutsSection; The compiler is giving an error: Type argument 'SiriShortcutsSection' is neither an Objective-C object nor a block type How do I define that 'section' object? And can I pass in an 'NSDictionary' for the item, or do I have to implement isEqual and hash on that as well? Should it be a custom object with an NSDictionary inside it? Thanks for the help.
Jul ’20
Reply to UITableViewDiffableDataSource: example in Objective-C
So I created a new class for that 'section' object and it works (compiles, at least): @interface CJSiriShortcutsSectionIdentifier : NSObject @property (nonatomic) SiriShortcutsSection sectionType; @end When I use it in a snapshot, and 'apply', it produces an empty tableview:     NSDiffableDataSourceSnapshot<CJSiriShortcutsSectionIdentifier *, NSDictionary *> *snapshot = [[NSDiffableDataSourceSnapshot alloc] init];     if (self.existingShortcutsSortedArray.count) {         CJSiriShortcutsSectionIdentifier *sectionExisting = [[CJSiriShortcutsSectionIdentifier alloc] initWithSection: SiriShortcutsSectionExisting];         [snapshot appendSectionsWithIdentifiers: @[sectionExisting]];         [snapshot appendItemsWithIdentifiers:self.existingShortcutsSortedArray intoSectionWithIdentifier:sectionExisting];     }     UITableViewDiffableDataSource <CJSiriShortcutsSectionIdentifier *, NSDictionary *> *dataSource = self.tableView.dataSource;     [dataSource applySnapshot:snapshot animatingDifferences:YES]; I know that self.existingShortcutsSortedArray has an array of NSDictionary objects. Is there something I'm missing? Do I need to implement isEqual on the CJSiriShortcutsSectionIdentifier class? Or something else as well?
Jul ’20
Reply to UITableViewDiffableDataSource: example in Objective-C
So the problem was something else. In viewDidLoad, I setup the datasource and assign it to the tableView, and create an empty initial snapshot, since the data hasn't loaded yet :     UITableViewDiffableDataSource <CJSiriShortcutsSectionIdentifier *, NSDictionary *> *dataSource = [[UITableViewDiffableDataSource alloc] initWithTableView:self.tableView cellProvider:cellProvider];     self.tableView.dataSource = dataSource;     NSDiffableDataSourceSnapshot<CJSiriShortcutsSectionIdentifier *, NSDictionary *> *snapshot = [[NSDiffableDataSourceSnapshot alloc] init];     [dataSource applySnapshot:snapshot animatingDifferences:NO]; Then in viewWillAppear, I make an async call to get the latest data, and then try to apply the snapshot there, using the tableview's datasource object, but that seemed to be 'nil' at that point for some reason: /*... after viewWillAppear loads data with an async call, call this on the dispatch_get_main_queue */     NSDiffableDataSourceSnapshot<CJSiriShortcutsSectionIdentifier *, NSDictionary *> *snapshot = [[NSDiffableDataSourceSnapshot alloc] init];     if (self.existingShortcutsSortedArray.count) {         CJSiriShortcutsSectionIdentifier *sectionExisting = [[CJSiriShortcutsSectionIdentifier alloc] initWithSection: SiriShortcutsSectionExisting];         [snapshot appendSectionsWithIdentifiers: @[sectionExisting]];         [snapshot appendItemsWithIdentifiers:self.existingShortcutsSortedArray intoSectionWithIdentifier:sectionExisting];     }     UITableViewDiffableDataSource <CJSiriShortcutsSectionIdentifier *, NSDictionary *> *dataSource = self.tableView.dataSource; /* THIS IS NIL*/     [dataSource applySnapshot:snapshot animatingDifferences:YES]; Turns out, the problem was that the UITableViewDiffableDataSource needed to be strongly retained by the view controller. Now it works fine, and loads the data into the tableview! Thanks for the help.
Jul ’20
Reply to UITableViewDiffableDataSource: example in Objective-C
Thanks for the reply; that's really helpful. I have it working now. To resolve my confusion, I created separate classes for both the SectionIdentifier and ItemIdentifier, and for both of them, implemented isEqual: and hash. For the ItemIdentifier, in the isEqual: and hash implementations, I had to include *both* the uniqueID and any other property that was possible to update. That way, when those properties change, they would reload that UITableViewCell automatically as well.
Jul ’20