Post

Replies

Boosts

Views

Activity

AsyncDNSResolver fails to resolve working hostname—why?
Note that AsyncDNSResolver is a fairly new Apple sponsored framework (search for it). I am trying to resolve a hostname (behind a CNAME) but cannot. In face even "ping" in mac Terminal can't. The host I start with is apidev.leaptodigital.com - when I ask for its CNAME: resolver.queryCNAME(name: "apidev.leaptodigital.com") I get: salespro-dev-server-2.eba-uxpxmksr.us-east-1.elasticbeanstalk.com Great! But nothing I try with that hostname returns an IP address. I tried queryCNAME again, then queryA, then queryAAAA. Yet I can send http traffic to this host, so its getting resolved somewhere. Note that nslookup in Terminal finds it just fine. David PS: tried older APIs like CFHostStartInfoResolution but they don't return anything either. Did not try getHostName as its use is discouraged.
1
0
308
Nov ’24
NWPathMonitor.pathUpdateHandler behavior
In my case there are three interfaces. I had a mental model that I now believe is incorrect. If any of the 3 interfaces is "satisfied", then I get one message telling me so. I guess if that one interface goes down, then I should get a second message that tells me that (this is hard to test as Xcode keeps disconnecting from my device when I switch to Settings to change things). in my case, wifi and cellular are both on. I launch the app, get notified that wifi is satisfied, but nothing on cellular. So my guess is there is a hierarchy: wired, wifi, and cellular. If the highest priority path is available, the others are assumed "off" since you have a path. Thus, you will never get "satisfied" for more than one path. Correct?
3
0
475
Dec ’24
Objective-C: instantiating a Class object
My company wants to be insure that if my Objective-C to Swift conversions fail in anyway, that the app can revert to using the older Objective-C code. By using a remotely controllable flag, the app can switch which code runs as, both are compiled into the app. Essentially, I create a protocol that describes the original class, then both classes (with a "s" or "o" appended to them) conform to the protocol. Protocol: Object Objective-C class: oObject Swift class: sObject That said, I hit one issue that I just can't seem reason out. I create a Objective-C function that returns the appropriate class: Class<Object> classObject(void) { if (myFlag) { return [sObject class]; } else { return [oObject class]; } } Swift deals with this really well - I can create an initialized object using: let object = classObject().init() but I cannot find a way to do this in Objective-C: Object *object = [[classSalesForceData() alloc] init]; fails with "No known class method for selector 'alloc'" Is there a way to do this? David PS: my workaround is to return an allocated object: Object *createObject(void) { if (myFlag) { return [sObject alloc]; } else { return [oObject alloc]; } }
4
0
498
Feb ’25
What does updating the Xcode Project Format do?
Select the Project in leftmost pane, open right most pane where Project Document is shown. My (quite old) project has the Project Format set to "Xcode 3.2" (which amazingly I used at one point!). I changed it to "Xcode 16.3", and even selected "Minimize Project References", closed the project, then re-opened it. However, the size of the "project.pbxproj" file didn't change at all. I'm told the newer formats reduce project size as well as reduce merge conflicts when new files are added to the project. Is there a "compress" option from the command line? Thanks, David
1
0
100
Apr ’25
Why doesn't Big Sur Terminal set environmental variables?
I found that COLUMNS is no longer set, and it caused issues using vi edit mode in the shell. I found nothing in Apple's docs about environmental variables, but did find this online: https:// + ss64.com + /osx/syntax-env_vars.html which lists a slew of variables, most of which I don't see. I don't see any option in Preferences to enable or disable this. HELP!
0
0
901
May ’21
Would ExternalAccesory support allow TCP traffic over the Lightning interface?
Some camera vendors support a FAT interface over a Lightning to camera/usb port. This would let an iOS app read files off the camera using a document browser (and it works just fine). The files are huge videos, and in some cases take over 50% of the record time to transfer over WiFi. One vendor unfortunately does not support this. They run PTP over their USB-C to Lightning cable, which means that Photos (or maybe Files, unsure now, I did verify it a while ago) on iOS can see and transfer the files. But my app is SOL - there is no apparent way to do this per Quinn. However - suppose the vendor would get certified with Apple as an ExternalAccessory - my app could then access the camera through some method they would support. This is going to be a tough sell, and just wondering what the minimal amount of technical work would be required on the vendors part to allow file retrieval.
0
0
862
Feb ’22
How can I break on this error in Xcode?
I'm getting this error in the console: *** -[__NSCFString substringWithRange:]: Range {18446744073709551615, 1} out of bounds; string length 43. This will become an exception for apps linked after 10.10 and iOS 8. Warning shown once per app execution. Great! So I created a category on NSString for _substringWithRange and _xxx_stringByReplacingCharactersInRange that call the original method (note undescore), then changed every usage in my app to use my own method, in which I test for location == NSNotFound. Nothing. So I swizzled both methods, and again tested for NSNotFound, and again nothing. What can I do to break when this error happens? Thanks David
1
0
1.4k
Jun ’22
What should happen if a Core Data app finds the Model is newer than its?
Have an app that has a half dozen models. We created a new app version with a new model that has an additional property on one entity. The options for the persistent store: do { let options = [ NSMigratePersistentStoresAutomaticallyOption: NSNumber(value: true), NSInferMappingModelAutomaticallyOption: NSNumber(value: true) ] let _ = try persistentStoreCoordinator.addPersistentStore(ofType: NSSQLiteStoreType, configurationName: nil, at: storeURL, options: options) } catch { try? FileManager.default.removeItem(at: storeURL) //Erase old sqlite // Make new persistent store for future saves let _ = try? persistentStoreCoordinator.addPersistentStore(ofType: NSSQLiteStoreType, configurationName: nil, at: storeURL, options: nil) } Launch this with data from a previous version. A breakpoint in the catch block never triggers so the migration must have worked. Since I'm in development, what happens if I run a different branch that doesn't have the new model? I assume the catch block is going to trigger—but it doesn't! Why doesn't it trigger? Does Core Data essentially ignore the new entity property, so all is well? I was just surprised ...
0
0
540
Jan ’24
Did autorelease pools become no-ops? Look at this memory usage graph!
Have an app in the store - 10K users. Using the same algorithm for years to download objects, convert them to ManagedObjects, then save them in a context. Been using the exact same Objective-C code for over 5 years - no changes. We build the app with Xcode 15.1, release it a few weeks ago, then slowly start getting reports of the app won't boot. Run the app in 15.1, look at memory usage, and it's a flat line up. But the code is littered with autorelease statements. For this download, max memory was 2.3G! No wonder so many users crashing! [Worked two weekends straight to get this fixed, but why did it happen???] The last developer told me he added those to reduce memory pressure, and that they worked for him. (Unfortunately no old memory usage graphs). But look at the attached image - memory usage increments in a straight line - no saw tooth where memory would get released. Oh, and this is in one runloop on the main thread (don't blame me, I didn't write the original code!):
2
0
629
Feb ’24