Feedback FB7556677This is my code:private lazy var pmC = NWPathMonitor(requiredInterfaceType: .cellular)
private lazy var pmW = NWPathMonitor(requiredInterfaceType: .wifi)
pmC.pathUpdateHandler = { (path: NWPath) in
print("C PATH STATUS:", path.status)
path.availableInterfaces.forEach( { interfce in
DispatchQueue.main.async {
print(" C INTERFACE:", interfce, "Status:", path.status)
}
} )
}
pmC.start(queue: assetQueue)
pmW.pathUpdateHandler = { (path: NWPath) in
print("W PATH STATUS:", path.status)
path.availableInterfaces.forEach( { interfce in
DispatchQueue.main.async {
print(" W INTERFACE:", interfce, "Status:", path.status)
}
} )
}
pmW.start(queue: assetQueue)Do a test. Lauch with both cellular and wifi on. Works as expected. Turn WIFI off, works again. Turn WIFI back on - nothing. So as far as I know, I've only got an "expensive network" available, even though WIFI is on and I can use it in Safari.Console Log:// WIFI and CELLULAR ON, launch
C PATH STATUS: satisfied
W PATH STATUS: satisfied
C INTERFACE: pdp_ip0 Status: satisfied
W INTERFACE: en0 Status: satisfied
// Turn Cell off
C PATH STATUS: unsatisfied
// Turn WIFI off
W PATH STATUS: unsatisfied
// Turn Cell on
C PATH STATUS: satisfied
C INTERFACE: pdp_ip0 Status: satisfied
C PATH STATUS: satisfied
C INTERFACE: pdp_ip0 Status: satisfied
C PATH STATUS: satisfied
C INTERFACE: pdp_ip0 Status: satisfied
// WIFI on
... nothingEven switched to Safari, opened a web page, then switched back. Nothing after many minutes.Note: iOS 13.3 iPhone 6s+ I tried and tried to get a sysdiagnose - volume buttons and power button for 1+ seconds, nothing happens.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
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
App build with latest Xcode latest MacOS, deployment is iOS 14.
It seems that in one App update, the search bar moved from centered low near the bottom of the NavigationBar to the right of the rightBarButtons. Previously we saw this:
Now we get this with the exact same code:
I dug around the UINavigationItem documentation, and there is a new property that lets you set the preferred placement:
if (@available(iOS 16.0, *)) {
navigationItem.preferredSearchBarPlacement = UINavigationItemSearchBarPlacementStacked;
}
That restore what our users use to see. But it will only work if the user is on iOS 16 - is there someway to get the old behavior on iOS 14+?
We directly set the navItem's searchBar: navigationItem.searchController = searchController
David
PS: I have to believe something changed in the iOS frameworks that caused this - our code hasn't changed in this area for years.
I'm getting infrequent crashes when I try to show a newly created PDF. The PDF is file based, and shortly after UIGraphicsEndPDFContext its shown.
The crash reports make it appear that the file itself is being mutated after its displayed.
So my question: is the file (self.filePath) absolutely flushed and closed when UIGraphicsEndPDFContext returns?
If not, is there some way to detect when it has finished?
Thanks!
David
`func addPageNumbers() {
let url = URL(fileURLWithPath: filePath)
guard let document = CGPDFDocument(url as CFURL) else { return }
// You have to change the file path otherwise it can cause blank white pages to be drawn.
self.filePath = "\(filePath)-final.pdf"
UIGraphicsBeginPDFContextToFile(filePath, .zero, nil)
let pageCount = document.numberOfPages
for i in 1...pageCount {
...
}
}
UIGraphicsEndPDFContext()
}
I'm sorta baffled right now. I am trying to wonder how I might detect a updated SQL Store in an older app.
have a baseline app, and create a SQL-based repository
in an updated app, change the model and verify that you can see the updated model version. Using lightweight migration
re-run the older app (which will inherit the newer SQL repository).
YIKES - no error when creating the NSPersistenStoreCoordinator!
Nothing in the metadata to imply the store is newer than the model:
[_persistentStoreCoordinator metadataForPersistentStore:store]
My question: is there any way to detect this condition?
David
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.
Topic:
App & System Services
SubTopic:
Networking
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
Topic:
Developer Tools & Services
SubTopic:
Xcode
I didn't really find anything in Apple docs on how to debug my extension using Xcode (so not saying it doesn't exist).
I found a current Stack post on it, with several devs all stuck. In 2024 someone said run the Preview Extension, select Finder as the test app, then in a Finder window select a file of the correct type and tap space.
Nothin happens when I do this (I get the file icon showing).
Suggestions most welcome!
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!
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.
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 ...