Post

Replies

Boosts

Views

Activity

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
"private lazy var ..." thread safe?
Just had a weird crash in development in Simulator - first of a kind. The crash was on this line:private lazy var regExTrimSet = NSCharacterSet(charactersInString: " \t\r\n_")and the error was some malloc() already released (grrr, should have copied it). Should that be thread safe? [Its being referenced by a bunch of concurrent blocks at one point]Also, I tried to find out where the Xcode console log might get written, but had no luck finding a link. Is there one that this error should be logged to?
6
0
5k
May ’22
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
891
Feb ’22
NWPathMonitor fails to report WIFI coming back if cellular is on
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.
1
0
1.4k
Jan ’22
Working code that uses "rtsp" seems to have broken recently
We had working code a few years ago, for a seldom used feature (streaming the camera image from a VIRB 360 camera). Trying to get it working again, but when I use a URLSession Data task to try and connect to this URL: rtsp://192.168.0.1/livePreviewStream?maxResolutionVertical=0 I get an error: Code=-1002 "unsupported URL" I vaguely remember trying to add permissions in the Info.plist for the local network, but it turned out for "http" we didn't need .t (so it got removed). But now I can't find a reference to it. Does the above error code look like its related to permissions? If not what? Thanks for any pointers! David
2
0
1.6k
Nov ’21
Bonjour stopped responding in iOS15
My company's app uses the following code to look for services advertised by a Garmin VIRB 360 camera (now discontinued and unsupported). In the past this code has worked fine. However, on my iPhone 12 Pro Max running iOS 15.0.2 it returns no services. let serviceBrowser = NetServiceBrowser() serviceBrowser.searchForServices(ofType: "_garmin-virb._tcp.", inDomain: "local.") Did something change in iOS 15? Do I need some entitlement? Is the format of the strings incorrect? My recollection is that the strings are from Garmin document (but its years old). Any help greatly appreciated!
3
0
1.2k
Oct ’21
WeakSelf/StrongSelf dance: __strong needed?
I read today in the Swift book:__weak typeof(self) weakSelf = self; self.block = ^{ __strong typeof(self) strongSelf = weakSelf; [strongSelf doSomething]; } // Excerpt From: Apple Inc. “Using Swift with Cocoa and Objective-C (Swift 3.1).”When I saw '__strong' I got a bit concerned - in the past I had always used "typeof(self) strongSelf = weakSelf;, think the typeof made strongSelf strong.Yikes! Did I get it wrong all these years???
2
0
3.2k
Sep ’21
Stuck on CGDataProviderCreateWithData
What I'd like to do is provide a CVPixelBuffer as the dataInfo argument to CGDataProviderCreateWithData that has an initializer:init?(dataInfo info: UnsafeMutableRawPointer?, data: UnsafeRawPointer, size: Int, releaseData: @escaping CGDataProviderReleaseDataCallback)My best (and probably wrong) approach to convert to a UnsafeRawPointer is:let pixelBuffer: CVPixelBuffer ... let ptr: UnsafeMutableRawPointer = UnsafeMutableRawPointer(mutating: &pixelBuffer)However, the releaseData callback function is defined as:typealias CGDataProviderReleaseDataCallback = (UnsafeMutableRawPointer?, UnsafeRawPointer, Int) -> VoidI cannot think of any way to get the CVPixelBuffer back from the UnsafeMutableRawPointer. Clearly I need help!
7
0
3.8k
Jun ’21
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
937
May ’21
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
Replies
1
Boosts
0
Views
1.4k
Activity
Jun ’22
"private lazy var ..." thread safe?
Just had a weird crash in development in Simulator - first of a kind. The crash was on this line:private lazy var regExTrimSet = NSCharacterSet(charactersInString: " \t\r\n_")and the error was some malloc() already released (grrr, should have copied it). Should that be thread safe? [Its being referenced by a bunch of concurrent blocks at one point]Also, I tried to find out where the Xcode console log might get written, but had no luck finding a link. Is there one that this error should be logged to?
Replies
6
Boosts
0
Views
5k
Activity
May ’22
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.
Replies
0
Boosts
0
Views
891
Activity
Feb ’22
NWPathMonitor fails to report WIFI coming back if cellular is on
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.
Replies
1
Boosts
0
Views
1.4k
Activity
Jan ’22
Working code that uses "rtsp" seems to have broken recently
We had working code a few years ago, for a seldom used feature (streaming the camera image from a VIRB 360 camera). Trying to get it working again, but when I use a URLSession Data task to try and connect to this URL: rtsp://192.168.0.1/livePreviewStream?maxResolutionVertical=0 I get an error: Code=-1002 "unsupported URL" I vaguely remember trying to add permissions in the Info.plist for the local network, but it turned out for "http" we didn't need .t (so it got removed). But now I can't find a reference to it. Does the above error code look like its related to permissions? If not what? Thanks for any pointers! David
Replies
2
Boosts
0
Views
1.6k
Activity
Nov ’21
How to read files on an external drive plugged into the Lightning port
I read that since iOS13 its possible to read an external drive connected via the Lightning port. Is it possible to read files from myApp? If so how. Thanks!
Replies
3
Boosts
0
Views
1.5k
Activity
Oct ’21
Bonjour stopped responding in iOS15
My company's app uses the following code to look for services advertised by a Garmin VIRB 360 camera (now discontinued and unsupported). In the past this code has worked fine. However, on my iPhone 12 Pro Max running iOS 15.0.2 it returns no services. let serviceBrowser = NetServiceBrowser() serviceBrowser.searchForServices(ofType: "_garmin-virb._tcp.", inDomain: "local.") Did something change in iOS 15? Do I need some entitlement? Is the format of the strings incorrect? My recollection is that the strings are from Garmin document (but its years old). Any help greatly appreciated!
Replies
3
Boosts
0
Views
1.2k
Activity
Oct ’21
WeakSelf/StrongSelf dance: __strong needed?
I read today in the Swift book:__weak typeof(self) weakSelf = self; self.block = ^{ __strong typeof(self) strongSelf = weakSelf; [strongSelf doSomething]; } // Excerpt From: Apple Inc. “Using Swift with Cocoa and Objective-C (Swift 3.1).”When I saw '__strong' I got a bit concerned - in the past I had always used "typeof(self) strongSelf = weakSelf;, think the typeof made strongSelf strong.Yikes! Did I get it wrong all these years???
Replies
2
Boosts
0
Views
3.2k
Activity
Sep ’21
Stuck on CGDataProviderCreateWithData
What I'd like to do is provide a CVPixelBuffer as the dataInfo argument to CGDataProviderCreateWithData that has an initializer:init?(dataInfo info: UnsafeMutableRawPointer?, data: UnsafeRawPointer, size: Int, releaseData: @escaping CGDataProviderReleaseDataCallback)My best (and probably wrong) approach to convert to a UnsafeRawPointer is:let pixelBuffer: CVPixelBuffer ... let ptr: UnsafeMutableRawPointer = UnsafeMutableRawPointer(mutating: &pixelBuffer)However, the releaseData callback function is defined as:typealias CGDataProviderReleaseDataCallback = (UnsafeMutableRawPointer?, UnsafeRawPointer, Int) -> VoidI cannot think of any way to get the CVPixelBuffer back from the UnsafeMutableRawPointer. Clearly I need help!
Replies
7
Boosts
0
Views
3.8k
Activity
Jun ’21
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!
Replies
0
Boosts
0
Views
937
Activity
May ’21