Post

Replies

Boosts

Views

Activity

Crash in NSDictionaryController -addObject:
Consider the following code fragments: @property (readonly) NSDictionaryController *loggedConfigsController; _loggedConfigs = NSMutableDictionary.dictionary; _loggedConfigsController = [NSDictionaryController.alloc initWithContent:self.loggedConfigs]; _loggedConfigsController.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"value" ascending:YES]]; _loggedConfigsController.preservesSelection = YES; _loggedConfigsController.avoidsEmptySelection = YES; _loggedConfigsController.selectsInsertedObjects = NO; _loggedConfigsController.automaticallyRearrangesObjects = YES; - (void)logEventWithTitle:(NSString *)title ident:(p_ident_t)ident { // called from main queue and dispatch queues NSString *identString = [self identStringForIdent:ident]; NSNumber *dictIdent = self.loggedConfigs[identString]; if (dictIdent == nil) { NSDictionaryControllerKeyValuePair *c = self.loggedConfigsController.newObject; c.key = identString; c.value = title; [self.loggedConfigsController addObject:c];// crash } } Crash log: Thread 4 Crashed:: Dispatch queue: Pinger #9 0 libobjc.A.dylib 0x7ff81bb7fcc3 objc_retain + 35 1 AppKit 0x7ff81f18d831 -[NSArrayController _setObjects:] + 49 2 AppKit 0x7ff81f18e502 -[NSArrayController _arrangeObjectsWithSelectedObjects:avoidsEmptySelection:operationsMask:useBasis:] + 365 Does anyone know why -addObject: fails? Any help is appreciated. Thanks in advance!
1
0
576
Mar ’23
Catalina madness
I can't believe that Xcode requires Catalina starting with 11.4. Are you guys at Apple living under a rock? To enumerate the problems Catalina has would take hours. I can't imagine any technical reasons for forcing Catalina on Xcode, this appears to be pure arbitrariness.Just FYI: I'm not a Facebook engineer, I don't have 10 development machines at my disposal, I have exactly 1 iMac where I write my Apps on and where I do all the other daily stuff with. And given the current state of Catalina, it would be very unwise to upgrade that iMac to Catalina. Consequently I'm stuck at iOS 13.2. Maybe someone at Apple can explain why 13.5 requires Xcode running on Catalina.I know what will be next: if anyone from Apple bothers to respond, the response will look like this: file a radr. Why do they do this? So that the problem can be moved out of the public eye and silently swept under the rug. While this might satifiy some managers, it will not solve the underlying problem: Catalina is not ready for production.To cut off regular customers from a stable OS and force them to use a public Catalina beta is one thing, but forcing developers is IMHO a scandal.
4
0
883
Jun ’20
Reliable way to detect disk capacity of an iOS device
For one of my apps the disk capacity of the device it is running on is important to know, for example iPhone 6 (16GB) or iPhone 7 (128GB). The canonical way to query the disk capacity appears to be through `NSFileManager`. A function that returns the device capacity in GB as an `NSNumber` might look like this :NSNumber * totalDiskSpaceInGb(void) { NSNumber *totalsize = [[NSFileManager.defaultManager attributesOfFileSystemForPath:NSHomeDirectory() error:nil] objectForKey:NSFileSystemSize]; return @(exp2(ilogb(totalsize.doubleValue) - 29)); }This funtion served me well in the last couple of years but occasionally the value returned is off, in both directions, so I ended up detecting an 4 GB iPhone 5c, or a 512 GB iPhone 7.The Settings.app displays the device capacity in General > About. Assuming that the algorithm is not the biggest secret at Apple, may I request how the Settings app calculates that value?
4
0
1.7k
May ’20
This API (currently) is a pile of half-baked crap
we are supposed to set up our own web server, and install some some unknown software that dynamically creates a JWT token? It would be nice if Apple could at least write some documentation how to achieve this. Until then I will of course store the token in-app, what else am I supposed to do, I'm a developer not a web server admin? Plus: Wasn't the original idea of the app store to avoid the requirement for developers to run their own server infrastructure?we are supposed to write tons of boiler plate code wrapping the whole API into either Objective-C or Swift classes, #defining dozens of API keywords, piping requests into data tasks and results through JSON parsers and create class instances of it, doing the same programming mistakes over and over until maybe some kind soul posts a working solution on github in 6 months? This is just sad and disappointing. This API should be wrapped into code like for example GameKit wraps its web API into Objective-C.
2
0
14k
Aug ’17