Post

Replies

Boosts

Views

Activity

Deleting an ubiquity container = giant mess?
TL;DR: Does Apple keep a list of ubiquity containers that a user has deleted, and prevent apps from creating the same ubiquity containers again? If so, where is this list, and how can I reset it? Long version: I'm developing an app that relies on having an ubiquity container (iCloud Drive folder). This was working fine until I decided to rename the folder. I deleted the existing folder with the old name, changed the value of "NSUbiquitousContainerName," and expected my app's code to create the new folder with the new name, as it had done originally. But the result has been a disaster. Now, in the simulator, all of my code is running without errors. The app thinks the iCloud Drive folder exists and can read and write files to it, but the folder only seems to exist in the simulator and is not visible via any iCloud Drive UI. When I run the exact same code on my iPhone, the code fails with the error 'You don’t have permission to save the file “Documents” in the folder “[whatever]”.' I have tried changing my app's bundle identifier and everything works swimmingly: the iCloud Drive folder is created instantly and is visible everywhere. So something is preventing things from working with the original bundle identifier and I need to figure out what it is and how to fix it. Does anybody have any ideas? Thanks in advance.
0
1
407
Jul ’24
why is autoreleasepool releasing objects that were retained?!
Hello! I'm using Core ML to do some machine learning predictions. It seems that I have to put the call to "predictionWithFeatures" in an autoreleasepool block, otherwise it will leak memory like crazy. (This is in a project with ARC turned off.) I need to be able to use the results of the prediction outside of the function that does the predictions. So, no problem, I just 'retain' the object that gets returned, right? Except that the autoreleasepool seems to free the object even though its retain count is 3. (Aside: why is it 3?) If anybody can tell me why the autoreleasepool block is freeing objects that have been retained, I would greatly appreciate it. Thank you! Pseudocode below... myCoreMLModelOutput *outputGlobal = NULL; void DoPredictions() { if (outputGlobal != NULL) { [outputGlobal release]; outputGlobal = NULL; } ... @autoreleasepool { // necessary to prevent predictionFromFeatures from leaking memory outputGlobal = [myCoreMLModel predictionFromFeatures ...]; [outputGlobal retain]; // need to be able to access this later printf("retain count: %d\n", (int)[outputGlobal retainCount]); // why is this 3 and not 1 or 2? } DoSomethingWithOutputGlobal(); // crashes ... why was outputGlobal released?! }
5
0
1.2k
Sep ’22
UITableView (UITableViewStyleGrouped) missing nice top padding in popovers
Usually, when I display a UITableView (UITableViewStyleGrouped) somewhere, there's a nice strip of gray padding at the top, above the first cell in the first section. But, when displayed in a popover on an iPad, the same UITableView appears with the first cell aligned to the top edge, i.e., you can't see any gray padding. If you drag the UITableView down with your finger, you can see that the padding exists, but as soon as you let go, the UITableView snaps back so that the top cell is aligned with the top edge. Curiously, if the top section has a header string, the UITableView behaves as you would expect. Any thoughts are appreciated!
1
1
1.1k
Jun ’22
Can you access iCloud Drive via C/C++ on iOS?
I'm trying to add iCloud Drive support to one of my apps, but it looks pretty tough using Apple's APIs. I notice that on my Mac, I can access my iCloud Drive storage just like any other directory, via ~Library/Mobile Documents/com~apple~CloudDocs. Is there an Apple-supported way to just access iCloud Drive (via iOS) using standard C or C++ file IO functions? Thanks in advance!
0
0
726
Jul ’20
Weird animation of UIModalPresentationPopover when keyboard is displayed
I'm working on an iPad app. The app displays a main menu via a UIModalPresentationPopover. The menu contains various text fields. The popover's source rect is located towards the bottom right corner, such that the popover's little arrow points to the right. (This is important for some reason.) When the keyboard becomes visible to edit some text, the popover does a curious animation as it slides up to get out of the way of the keyboard. It instantly resizes itself to infinitesimally small when it starts sliding up, and then expands back to its original size as it's sliding up. If I change the source rect of the popover such that the little popover arrow points down instead of to the side, it does not do this contract-then-expand animation. The app did not do this when it was built for iOS 11 (or 12?) but is now doing it when built for iOS 13. I just checked by running my old source code and it does seem to be new-for-iOS-13 weirdness. Does anybody have an explanation for this, or any idea for how to get it to stop doing this? Thanks in advance!
2
0
655
Jun ’20
How to make [AVAudioPlayerNode scheduleFile] play immediately without clipping
If I call [AVAudioPlayerNode scheduleFile] with atTime = nil, my sound plays very nicely but only after all other sounds have finished playing. This is inappropriate for the project I'm working on, I need sound effects to be able to play simultaneously. So now I'm calling scheduleFile to play a sound with atTime = mach.absolute.time(). (Underscores instead of dots.) The problem is, the beginnings of the sounds are often clipped, because presumably it takes a fraction of a second to copy the sound to the output buffer. So I guess I could add an arbitrary delay to when I want the sound to play, but that's very hacky. Is there a way to tell scheduleFile, "play the entire sound as soon as you're ready to play it, even if other sounds are playing simultaneously." Thanks in advance!
3
0
986
Jun ’20
Why am I not getting deprecation warnings for UIAlertView?
I have an old iOS project that I'm updating.It uses UIAlertView a lot, which was deprecated in iOS 9, but I'm not seeing any deprecation warnings when I build the app.(I've seen warnings when updating other apps.)This is concerning me. If I'm not seeing these warnings, what other warnings am I missing?I've checked the build settings for the app and under "Apple LLVM 8.1 - Warnings - All languages" the setting for "Deprecated Functions" is set to "Yes" as it seems like it should be.I've grepped my entire project for the words "deprecate" and "warning" and "pragma" and nothing's showing up that would suppress these warnings.Does anybody have any advice for other things to check? Thanks in advance! (BTW, I'm using XCode 8.3.3 8E3004b.)
3
0
3.2k
Jul ’17