|
NSFIleManager enumeratorAtPath problem
The OP was calling -[NSFileManager enumeratorAtPath:], which is an old API that predates NSError, so failing silently is all it can do. (Cocoa APIs do not throw exceptions except in the case of progra
The OP was calling -[NSFileManager enumeratorAtPath:], which is an old API that predates NSError, so failing silently is all it can do. (Cocoa APIs do not throw exceptions except in the case of progra
|
By
Jens Alfke
· #991
·
|
|
How to get Extended File Info
No, I’ve used it with MP3 and AAC and AIFF; I’m pretty sure it supports every format there’s a system codec for (i.e. most audio formats except Ogg and FLAC, but you can get 3rd party components to do
No, I’ve used it with MP3 and AAC and AIFF; I’m pretty sure it supports every format there’s a system codec for (i.e. most audio formats except Ogg and FLAC, but you can get 3rd party components to do
|
By
Jens Alfke
· #987
·
|
|
How to get Extended File Info
AVFoundation has a higher-level OOP API for this. Look for methods for accessing metadata, and constants defining the various metadata types like Title, Artist, etc. —Jens
AVFoundation has a higher-level OOP API for this. Look for methods for accessing metadata, and constants defining the various metadata types like Title, Artist, etc. —Jens
|
By
Jens Alfke
· #985
·
|
|
Dealing with unicodes in strings
Those are JavaScript escape sequences. If you’re reading raw JS string literals out of the page, you need to decode all the escapes, which are like the C ones plus \uxxxx. This isn’t anything to do wi
Those are JavaScript escape sequences. If you’re reading raw JS string literals out of the page, you need to decode all the escapes, which are like the C ones plus \uxxxx. This isn’t anything to do wi
|
By
Jens Alfke
· #968
·
|
|
How to Display a Time Interval
You want NSDateComponentsFormatter: /* NSDateComponentsFormatter provides locale-correct and flexible string formatting of quantities of time, such as "1 day" or "1h 10m", as specified by NSDateCompon
You want NSDateComponentsFormatter: /* NSDateComponentsFormatter provides locale-correct and flexible string formatting of quantities of time, such as "1 day" or "1h 10m", as specified by NSDateCompon
|
By
Jens Alfke
· #960
·
|
|
Why would an instance of NSMutableArray be immutable?
Nope. This is due to the way CF bridging works — the magic class __NSCFArray (?) is bridged to CFArray and CFMutableArray. To support mutable arrays, that means __NSCFArray has to subclass NSMutableAr
Nope. This is due to the way CF bridging works — the magic class __NSCFArray (?) is bridged to CFArray and CFMutableArray. To support mutable arrays, that means __NSCFArray has to subclass NSMutableAr
|
By
Jens Alfke
· #958
·
|
|
Selectable text in NSTableView?
That’s the behavior I was getting the last time I worked on this app, a few months ago, but it’s somehow stopped working and I can’t get it to work again. Specifically, what used to work was 1. Click
That’s the behavior I was getting the last time I worked on this app, a few months ago, but it’s somehow stopped working and I can’t get it to work again. Specifically, what used to work was 1. Click
|
By
Jens Alfke
· #926
·
|
|
Selectable text in NSTableView?
I think that reply was meant for a different thread? —Jens
I think that reply was meant for a different thread? —Jens
|
By
Jens Alfke
· #925
·
|
|
Selectable text in NSTableView?
I’ve got a view-based NSTableView that uses NSTextFields. I’d like to be able to select text in some of the columns, mostly so it can be copied to the pasteboard. If I set the “selectable” property of
I’ve got a view-based NSTableView that uses NSTextFields. I’d like to be able to select text in some of the columns, mostly so it can be copied to the pasteboard. If I set the “selectable” property of
|
By
Jens Alfke
· #920
·
|
|
macOS Drag and Drop onto App Icon
Same as it ever was — just implement the -application:openFile: method in your app delegate. You also need to edit your Info.plist to include the document types your app knows how to open. To my knowl
Same as it ever was — just implement the -application:openFile: method in your app delegate. You also need to edit your Info.plist to include the document types your app knows how to open. To my knowl
|
By
Jens Alfke
· #907
·
|
|
Some advice requested on debugging a difficult problem. iOS.
At the runtime level, properties are implemented as getter and/or setter methods. The `getter=` syntax just lets you rename the getter method. It doesn’t affect the property name. It seems a little we
At the runtime level, properties are implemented as getter and/or setter methods. The `getter=` syntax just lets you rename the getter method. It doesn’t affect the property name. It seems a little we
|
By
Jens Alfke
· #895
·
|
|
Care to opine on a stack trace
It’s in the crash report near the top, like this: Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000 That long hex number is the address. —Jens
It’s in the crash report near the top, like this: Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000 That long hex number is the address. —Jens
|
By
Jens Alfke
· #880
·
|
|
Care to opine on a stack trace
Not exactly. In frame 4 the NSInputStream has been messaged successfully, which almost never happens if it’s already dealloced; you almost always get a crash in objc_msgsend in that case. Instead it l
Not exactly. In frame 4 the NSInputStream has been messaged successfully, which almost never happens if it’s already dealloced; you almost always get a crash in objc_msgsend in that case. Instead it l
|
By
Jens Alfke
· #878
·
|
|
Need help understanding a threading issue
The only reason I can think of that the first two attempts wouldn’t work is that the main thread’s runloop is blocked, so it can’t process queued blocks. Are you by chance doing something on the main
The only reason I can think of that the first two attempts wouldn’t work is that the main thread’s runloop is blocked, so it can’t process queued blocks. Are you by chance doing something on the main
|
By
Jens Alfke
· #860
·
|
|
Word detection without separating spaces
NSLinguisticTagger provides a lot of operations like finding word boundaries and identifying parts of speech. I don’t know if it can be made to identify English words without spaces between them.* App
NSLinguisticTagger provides a lot of operations like finding word boundaries and identifying parts of speech. I don’t know if it can be made to identify English words without spaces between them.* App
|
By
Jens Alfke
· #809
·
|
|
Updating to Xcode 10
Xcode stopped supporting the GNU C++ lib a few releases ago. You’ll need to use Clang’s libc++ instead. Hopefully there should be few compatibility problems. —Jens
Xcode stopped supporting the GNU C++ lib a few releases ago. You’ll need to use Clang’s libc++ instead. Hopefully there should be few compatibility problems. —Jens
|
By
Jens Alfke
· #752
·
|
|
Updating to Xcode 10
I build a lot of C++ and I don’t think I’ve ever seen that. Are you overriding the header search path or specifying any exotic compiler flags already? And double-check that you’ve got a valid SDK sele
I build a lot of C++ and I don’t think I’ve ever seen that. Are you overriding the header search path or specifying any exotic compiler flags already? And double-check that you’ve got a valid SDK sele
|
By
Jens Alfke
· #731
·
|
|
XPC Question
Not as far as I know. In general, it’s a bad idea to use this sort of “hidden” RPC across a network. Networking is fundamentally unlike local function calls, and making a network call look exactly lik
Not as far as I know. In general, it’s a bad idea to use this sort of “hidden” RPC across a network. Networking is fundamentally unlike local function calls, and making a network call look exactly lik
|
By
Jens Alfke
· #703
·
|
|
dispatch_get_current_queue
That may be Swift-only … it doesn't show up in the 10.14 SDK headers. (Gerriet is using Obj-C, as indicated by his code snippet.) —Jens
That may be Swift-only … it doesn't show up in the 10.14 SDK headers. (Gerriet is using Obj-C, as indicated by his code snippet.) —Jens
|
By
Jens Alfke
· #678
·
|
|
How to get DOMDocument from WkWebView
I do the same thing (in an app I've been tinkering with for years), but it's a dead end. WkWebView runs the WebView in a separate process, for security reasons, which means its DOM objects are complet
I do the same thing (in an app I've been tinkering with for years), but it's a dead end. WkWebView runs the WebView in a separate process, for security reasons, which means its DOM objects are complet
|
By
Jens Alfke
· #596
·
|