Re: Exception handling

2018-06-15 Thread Jens Alfke
> On Jun 14, 2018, at 5:58 PM, Quincey Morris > wrote: > > as someone already mentioned, NSExceptions can’t successfully cross > dylib/framework boundaries. They can, actually; there is no problem with this at the ABI/runtime level. I think what you mean is that most libraries/frameworks do

Re: Exception handling

2018-06-14 Thread Jens Alfke
> On Jun 14, 2018, at 11:33 AM, Casey McDermott wrote: > > However, simply replacing the C++ throw with a Cocoa exception via > [NSException raise : errString format : errString]; seems to work great. Yeah, I think that’s because the exception type being thrown is now NSException* instead of

Re: Exception handling

2018-06-14 Thread Jens Alfke
> On Jun 14, 2018, at 10:11 AM, Alastair Houghton > wrote: > > I don’t think it’s changed in any obvious way; the framework has always > swallowed exceptions in certain contexts, but not in others. Obviously the > precise detail may have changed over time, but it’s certainly crashed on > ex

Re: Exception handling

2018-06-14 Thread Jens Alfke
> On Jun 13, 2018, at 7:53 PM, Quincey Morris > wrote: > > The situation with C++ exceptions is a bit different. It's actually exactly the same, since at the runtime level Obj-C exceptions are C++ exceptions. > I really think you have exactly 2 error handling patterns: > 1. Returning false

Re: Exception handling

2018-06-14 Thread Jens Alfke
> On Jun 13, 2018, at 7:22 PM, Casey McDermott wrote: > > Our Carbon event loop had a try/catch block, which caught most exceptions, > and then > continued. It started as an expedient in early production, but it remained > in production code > since it often allows users to continue, save t

Re: Crashes inside CFStringDeallocate

2018-06-07 Thread Jens Alfke
> On May 29, 2018, at 7:39 AM, Alastair Houghton > wrote: > > There’s clearly some kind of bug in your code, but it doesn’t appear to be in > the lines you showed us. If I had to guess, I’d say you’ve over-released > your NSString somehow (leading to an attempted double free of the underlyi

Re: Deleting files extremely slow since OSX High sierra

2018-04-27 Thread Jens Alfke
> On Apr 27, 2018, at 6:29 AM, Andreas Falkenhahn > wrote: > > No big deal... just have Cocoa convert your string to precomposed > or decomposed UTF-8. Just use NSString.fileSystemRepresentation, and -[NSString initWithFileSystemRepresentation:] to go the other way. They are guaranteed to d

Re: Avoiding link conflicts with a static library

2018-04-04 Thread Jens Alfke
> On Apr 4, 2018, at 12:17 PM, Redler Eyal wrote: > > 1. It makes it easier to pirate our technology (having our stuff neatly > packaged seperaterly) > 2. (More importantly) It makes the client's binary larger since it will have > to include our full library, including simulator code. (corre

Re: Avoiding link conflicts with a static library

2018-04-04 Thread Jens Alfke
> On Apr 4, 2018, at 11:34 AM, Alastair Houghton > wrote: > > You could rename the symbols in your copy of OpenCV so that they don’t match > the standard ones. One way to do that is with the preprocessor (use #defines > to change the names of the OpenCV functions you use), which potentially

Re: Avoiding link conflicts with a static library

2018-04-04 Thread Jens Alfke
> On Apr 4, 2018, at 9:25 AM, Redler Eyal wrote: > > We are aware that the following are possible solutions to the problem: > a. Switch to use the same version of OpenCV as our client. > b. Build our framework as a dynamic library (where we a supposed to be able > to hide openCV inside) > Both

Re: NSSecureCoding & NSAttributedString

2018-02-16 Thread Jens Alfke
> On Feb 16, 2018, at 4:51 PM, Quincey Morris > wrote: > > Unless someone has a bright idea, I don’t any way around concluding that > NSAttributedString can’t be used with NSSecureCoding. You could encode the NSAttributedString as RTF, which is trivially serializable. However, I don’t know i

Re: Checking if a string is valid JSON

2018-01-29 Thread Jens Alfke
> On Jan 29, 2018, at 12:17 PM, Eric E. Dolecki wrote: > > I am generating a String of JSON. Before I use it, I want to check to make > sure that it's valid. Is there a reason you need to generate the JSON by hand, instead of creating a Dictionary or Array and letting NSJSONSerialization enc

Re: Problem with NSWorkspace.shared and uid 0

2017-12-13 Thread Jens Alfke
Honestly, I don’t think AppKit is considered OK to use as root. (Have you checked Apple’s giant tech note on daemons and agents?) —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to t

Re: Getting immutable UIImage data pointer without copy?

2017-11-14 Thread Jens Alfke
> On Nov 14, 2017, at 8:11 PM, Rick Mann wrote: > > Maybe, at least for the bonus question. The bigger question is around the > copy. Where pixmaps live is a pretty complex issue — ideally they live in the GPU’s address space as textures so they can be blitted efficiently, and that’s often

Re: NSTimer not firing when computer is inactive for a while.

2017-11-14 Thread Jens Alfke
> On Nov 14, 2017, at 4:43 PM, Nathan Day wrote: > > The background app is kept alive by launchd as a User Agent and looks for new > resources to be downloaded periodically If this is a launchd agent, you can configure its plist so it gets launched periodically. That way it won’t have to kee

Re: Register media source to system

2017-10-23 Thread Jens Alfke
> On Oct 22, 2017, at 11:39 AM, Totte Alm wrote: > > Om Mac OS X (not iOS), I need to take video and/or audio from input > devices(like built in iSight ot FaceTime cameras), found using the standard > AVCaptureDevice.devices(); and then make it available for other applications > using the sa

Re: [ANN] Nursery Framework 1.0.1 (build with Xcode 9) released

2017-10-23 Thread Jens Alfke
Some notes on the packaging: * I couldn’t find any documentation, or any doc-comments describing classes or methods. That’s going to make it very hard for anyone to learn how to use the library. * The implementation is also completely uncommented as far as I could tell. That makes it much harde

Re: Problem using NSTimer in privileged helper tool

2017-10-20 Thread Jens Alfke
> On Oct 20, 2017, at 9:56 AM, Quincey Morris > wrote: > > — When you scheduled the timer on the main run loop, it was actually being > scheduled on the main app’s run loop. When it was block based, only the block > had to be passed across the XPC interface (which somehow works), but when it

Re: Programmatically create a file at ~/Downloads with animation

2017-10-02 Thread Jens Alfke
> On Oct 2, 2017, at 3:51 PM, Nick wrote: > > Is it possible to create a file with an animation of a flying file into the > Downloads "Fan" directory in Dock, like Safari does when it downloads a new > file? As far as I know, that’s just a magic thing Safari implements. :( I don’t think there’

Re: [NSButton state] must by used from the main thread

2017-09-26 Thread Jens Alfke
> On Sep 26, 2017, at 1:16 AM, Tamas Nagy wrote: > > “state” of the NSButton is a NSInteger property, so that should be safe to > read from a background thread, right? No. You can’t tell anything about a property’s implementation from its return type. You’re assuming it’s a synthesized gette

Re: using AppleScript to print an HTML document

2017-09-25 Thread Jens Alfke
> On Sep 24, 2017, at 1:22 PM, Alan Snyder wrote: > > I’m trying to use AppleScript to get Safari to print an HTML document > (showing the print dialog) and am having no luck with the direct approach. This isn’t really a Cocoa development question … try the AppleScript list at https://apple-

Re: AVSpeechSynthesizer in iOS 11?

2017-09-19 Thread Jens Alfke
> On Sep 19, 2017, at 10:57 AM, Eric E. Dolecki wrote: > > Anyone know if there is a trick to getting the new voice in iOS > 11 AVSpeechSynthesizer? I am hearing the older, more robotic version of > Siri. Does Siri use the new voice on this device? I read today that only newer iOS devices hav

Re: Inserting a button into another application's toolbar

2017-09-18 Thread Jens Alfke
> On Sep 18, 2017, at 2:35 PM, Nick wrote: > > adding/injecting a toolbar icon > with a custom handler code into the main window of the application. Sorry, there's no reasonable way to do that if the app doesn't already support plugins. There used to be some awful hacks that patched into the

Re: Ignore Spelling not persistent?

2017-08-23 Thread Jens Alfke
> On Aug 23, 2017, at 12:03 PM, Mike Crawford wrote: > > I suggest filing a feature request to recommend Apple create a > standardized way to share that ignore list among all applications. If you want to ignore a spelling across all applications, you use the Learn command. Ignore is specific

Re: Ignore Spelling not persistent?

2017-08-22 Thread Jens Alfke
> On Aug 22, 2017, at 6:26 PM, Alan Snyder wrote: > > The documentation that I have seen for the Ignore Spelling contextual menu > item says that it applies to the current document, but does not say one way > or the other whether the setting is persistent. As far as I can tell, the > setting

Re: Decompressing JPEG data into specific format, getting raw pixels

2017-08-16 Thread Jens Alfke
> On Aug 16, 2017, at 4:29 PM, Sean McBride wrote: > > Right, but then I'm back where I started. :( Because there's (apparently) no > way to ensure that the NSBitmapImageRep I get is in a particular format, and > I absolutely need 8 bit per pixel & greyscale. I believe image decoding and col

Re: Question about NSObject based Class & delegates

2017-08-14 Thread Jens Alfke
That should work. What’s the crash (backtrace, other messages?) —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.

Re: Is "-init" really needed?

2017-08-07 Thread Jens Alfke
> On Aug 7, 2017, at 5:23 PM, Carl Hoefs wrote: > > Is the use of +new discouraged also? No, I use it all the time. It’s simply shorthand for [[XXX alloc] init]. These days with ARC, I tend to use +new instead of factory class methods — e.g. [NSMutableArray new] instead of [NSMutableArray arr

Re: Is "-init" really needed?

2017-08-07 Thread Jens Alfke
> On Aug 7, 2017, at 5:02 PM, David Hoerl wrote: > > But then I though - heck, if Foo has NSObject as its super class, gee, maybe > -init isn't really need. I mean, if all of Foo's ivars and properties are > initialized, its a shortcut, right. -[NSObject init] happens to be a no-op empty meth

Re: [webkit-dev] How to display new MIME types?

2017-07-22 Thread Jens Alfke
> On Jul 21, 2017, at 7:19 PM, Conrad Shultz wrote: > > You can build a Safari extension as an app extension bundled with an app, > meaning you can write your extension in Swift or Objective-C (and JavaScript). It doesn’t look like these can do what the OP wants to do — display a specific MIM

Re: adding arc to a fundamentally non-arc project

2017-07-15 Thread Jens Alfke
> On Jul 15, 2017, at 2:00 PM, Matthew Weinstein wrote: > > Trying to move from QTKit to AVKit. Compiling on El Capitan (at the moment). > So I have a handler that is arc and handles all the AVKit stuff and compiled > with the -fobjc-arc flag in the build phases... I create and assign the > h

Re: Who owns a child view controller?

2017-07-12 Thread Jens Alfke
> On Jul 12, 2017, at 2:03 PM, Greg Parker wrote: > > The benefit of the autoreleasing convention comes when you can return an > unretained value without a retain/autorelease pair, because you "know" that > the object will live long enough for the callee to use it. This does in fact > avoid l

Re: Who owns a child view controller?

2017-07-12 Thread Jens Alfke
> On Jul 12, 2017, at 2:57 PM, Jeremy Hughes > wrote: > > I’m trying to understand memory management so I can avoid retain cycles and > other issues. That’s fine. But using a weak reference to try to detect when an object gets dealloced is fraught with peril, viz. this entire thread :) If y

Re: Who owns a child view controller?

2017-07-12 Thread Jens Alfke
> On Jul 12, 2017, at 10:57 AM, Jeremy Hughes > wrote: > > Wouldn’t it be ARC (rather than the consumer) that is balancing retains? Yes. ARC internally generates calls to -autorelease (or actually to some C functions in the runtime that invoke autorelease.) —Jens

Re: Who owns a child view controller?

2017-07-12 Thread Jens Alfke
> On Jul 12, 2017, at 10:38 AM, Charles Srstka wrote: > > While that’s true, the main reason, as I understand it, that ARC doesn’t know > enough about the object’s lifetime is that non-ARC code may be calling the > method. In an all-ARC world, a method could always just return objects with a

Re: Who owns a child view controller?

2017-07-12 Thread Jens Alfke
> On Jul 12, 2017, at 9:54 AM, Jeremy Hughes > wrote: > > I’d forgotten about autorelease pools - but I guess they’re still there in > Cocoa for backwards compatibility with pre-ARC code. Autorelease is still necessary with ARC. There are cases where ARC doesn’t know enough about object life

Re: Who owns a child view controller?

2017-07-12 Thread Jens Alfke
> On Jul 12, 2017, at 9:34 AM, Jeremy Hughes > wrote: > > // Prints "Why is childReference not nil?” There may still be a reference in the autorelease pool. Check childReference again ‘later’, i.e. on the next user event or after a timer/delayed-perform. —Jens ___

Re: Increasing stack size of NSDocument's open file thread

2017-07-06 Thread Jens Alfke
> On Jul 6, 2017, at 8:42 AM, Steve Mills wrote: > > Why can't you spawn your own thread to do the recursive code? Create the > NSThread, set its stack size, light its fuse to do the processing, and delete > it. This. Although I would also consider looking at your code to see if it can be re

Re: Very slow NSTableView

2017-07-04 Thread Jens Alfke
> On Jul 4, 2017, at 12:00 AM, Graham Cox wrote: > > Heh, well, I wish I knew. > Instruments isn’t working. It’s a new machine which I set up from my older > machine. XCode works fine, but Instruments doesn’t. I guess that just copying > stuff over isn’t enough to install it. FYI, you don’t n

Re: file encription/decriptoin iOS

2017-06-29 Thread Jens Alfke
> On Jun 29, 2017, at 5:33 AM, Dave Fernandes > wrote: > > Ah. Thinking about the new device use case helps. Everything must be > accessible and decryptable using only the iCloud passphrase. But if the same > passphrase is used both to authorize access to the data and to decrypt it, > then A

Re: file encription/decriptoin iOS

2017-06-28 Thread Jens Alfke
> On Jun 28, 2017, at 8:04 PM, Dave Fernandes > wrote: > > So everything is protected by the iCloud Drive service key, but what does > “which is then stored with the user’s iCloud account” mean? Is it stored on > the device or in iCloud? That makes all the difference. I agree it’s vague. The

Re: file encription/decriptoin iOS

2017-06-28 Thread Jens Alfke
> On Jun 28, 2017, at 6:33 AM, Sandor Szatmari > wrote: > > I thought there were both local and iCloud Notes, no? Not sure what you’re asking, but: Anything saved to iCloud goes through end-to-end encryption, so there’s no way to read it on the iCloud servers without using keys stored on you

Re: file encription/decriptoin iOS

2017-06-27 Thread Jens Alfke
> On Jun 26, 2017, at 10:24 PM, Jens Alfke wrote: > > There’s some use in a scenario like this, and it could be a nice feature to > add to apps … if there were a convenient and trustworthy file encryption API > available. But there doesn’t seem to be. I just remembered

Re: file encription/decriptoin iOS

2017-06-27 Thread Jens Alfke
> On Jun 27, 2017, at 5:18 AM, Alex Zavatone wrote: > > We had 3 programmers each with 6 years of iOS development who couldn’t figure > that out. We got bitten bad because of that. Not sure what to say about that … it’s all there in the docs. But it’s a pretty frequently asked question inv

Re: Is cloning the same as copying in APFS?

2017-06-26 Thread Jens Alfke
> On Jun 26, 2017, at 7:38 PM, Rick Mann wrote: > > But there's actually a POSIX "clone" API, and so I wonder if a copy is > different from a clone. The low level file copying API that I’m aware of is , which is Apple specific. It has options for doing copy-on-write. I don’t know if NSFileMan

Re: file encription/decriptoin iOS

2017-06-26 Thread Jens Alfke
> On Jun 26, 2017, at 7:25 PM, Sandor Szatmari > wrote: > > This is an interesting thread. The OP's original question made me think of > the functionality Apple recently (how recently I'm not sure) added to the iOS > Notes app. It allows you to selectively 'encrypt' (password protect) a not

Re: file encription/decriptoin iOS

2017-06-26 Thread Jens Alfke
> On Jun 26, 2017, at 9:50 AM, Alex Zavatone wrote: > > You can use the iExplore app to look in the Documents folder of any device > you attach to your Mac. But you can only attach a device to your Mac if the device is unlocked, since you have to OK the “Do you trust this computer?” alert. A

Re: file encription/decriptoin iOS

2017-06-26 Thread Jens Alfke
What Alastair said. (I’m usually not one for “me too” comments, but in this case since you’re being advised to not do something I thought another vote might be useful.) I have about a dozen years’ experience working with crypto APIs on Apple platforms. Crypto is difficult to understand and diff

Re: AVCaptureMovieFileOutput + encryption

2017-06-23 Thread Jens Alfke
> On Jun 23, 2017, at 12:13 PM, Carl Hoefs > wrote: > > Whenever we've tried implementing our own real-time video callbacks, the > frame rate drops to about 10 fps. That was a couple of years ago; I could > revisit the issue. Were those callbacks receiving frame-buffers, or encoded data? Thi

Re: AVCaptureMovieFileOutput + encryption

2017-06-23 Thread Jens Alfke
> On Jun 23, 2017, at 10:33 AM, Steve Bird wrote: > >> I'm currently recording 1280x720 at 240fps H.264 video on the iPhone > > Just curious - can you tell us what you are recording at 240 fps ? Since HIPAA healthcare regulations are involved, I’m guessing it’s an endoscopic camera app — swal

Re: AVCaptureMovieFileOutput + encryption

2017-06-23 Thread Jens Alfke
> On Jun 23, 2017, at 10:22 AM, Carl Hoefs > wrote: > > At this high frame rate, I'm expecting that callbacks would not be able to > keep up in real time without an unacceptably high rate of dropped frames. > Having the encryption integrated within the capture / movie file chain would > be i

Re: Doubled Pixels

2017-06-23 Thread Jens Alfke
> On Jun 23, 2017, at 8:45 AM, Gerriet M. Denkmann wrote: > > the image looks fine, but when I write subData to disk, it has 64 x 64 pixels. You’re probably running this on a computer with a Retina display, so NSImage creates a 2x-resolution backing store by default. Try creating an NSBitmapI

Re: AVCaptureMovieFileOutput + encryption

2017-06-22 Thread Jens Alfke
> On Jun 22, 2017, at 5:18 PM, Carl Hoefs > wrote: > > Is it possible to add encryption to this chain, so the movie file is written > out encrypted? I’ve never seen any crypto stuff in AVFoundation (but it’s been a few years.) You’ll probably need to hook something in to run your own callba

Re: How to create an animated gif?

2017-06-21 Thread Jens Alfke
> On Jun 20, 2017, at 11:17 PM, Gerriet M. Denkmann wrote: > > Assume that I have two NSImages, both with the same size, how can I create an > animated gif which alternates between these two images? You might have to use a 3rd party image library to do that; I’ve never heard of animated-GIF (

Re: Deep linking from 1 tvOS app to another

2017-06-16 Thread Jens Alfke
> On Jun 16, 2017, at 8:00 AM, Eric E. Dolecki wrote: > >let modified = supplied.replacingOccurrences(of: " ", with: "+") Don’t use “+”, use “%20”. The “+” is only valid in some contexts IIRC, like form values. Actually don’t do the substitution by hand. Let NSString URL-encode it

Re: iOS Drag and Drop

2017-06-13 Thread Jens Alfke
It’s right in the developer docs. In Xcode 9 open the doc viewer, flip open UIKit in the outline on the left, then select Drag And Drop. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator commen

ANN: New unofficial developer mailing lists

2017-06-06 Thread Jens Alfke
You may have seen the announcement that the xcode-users mailing list is going away. On the assumption that it’s only a matter of time before the rest of lists.apple.com follows suit, I’ve taken the initiative to make a new set of mailing lists at groups.io. So far there’s an Xcode and a Cocoa l

Re: Relative URLs, and string encodings

2017-06-01 Thread Jens Alfke
> On Jun 1, 2017, at 7:44 AM, Jonathan Taylor > wrote: > > My attempt like: > [NSURL URLWithString:[path > stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding] > relativeToURL:relativeTo]; Ah, you want NSUTF8StringEncoding instead. Generally speaking, URL encoding always uses UT

Re: Process.launch() in Swift

2017-05-31 Thread Jens Alfke
> On May 31, 2017, at 8:01 AM, David Catmull wrote: > > The documentation for Process.launch() (the equivalent of -[NSTask launch]) > says it "raises an NSInvalidArgumentException if the launch path has not > been set or is invalid or if it fails to create a process", and yet the > function is n

Re: Exporting a public key from the secure enclave

2017-05-15 Thread Jens Alfke
Is there a specific reason you’re trying to work with the secure enclave directly, and not just the keychain? In my experience the Keychain APIs are mind-curdlingly horrible to work with, and the newer the feature you’re trying to use, the worse they get. Have you tried doing this stuff without

Re: Times in other cities

2017-05-14 Thread Jens Alfke
> On May 14, 2017, at 5:47 PM, Eric Dolecki wrote: > > I have a clock. If like to present the times in a few major cities. Say > London, England. Based on the user's current time zone, present the correct > hour, min, and second for London. If I can see how to do it for one city, I > should

Re: __nw_connection_get_connected_socket_block_invoke 15 Connection has no connected handler

2017-05-07 Thread Jens Alfke
> On May 7, 2017, at 4:08 PM, Rick Mann wrote: > > Our app, which does a ton of network calls, gets a lot of console log > messages like: > > __nw_connection_get_connected_socket_block_invoke 15 Connection has no > connected handler I’ve seen this too. Someone on macnetworkprog might know wh

Re: Creating NSStrings without copying memory

2017-05-02 Thread Jens Alfke
> On May 2, 2017, at 1:42 PM, Mike Abdullah wrote: > > Drop down to CFString. It has similar api to the NSData one you like. Oh, you mean CFStringCreateWithBytesNoCopy? You’re right, I can use that the same way. I was being fixated on something that takes a block, and didn’t realize that (wit

Creating NSStrings without copying memory

2017-05-02 Thread Jens Alfke
I’ve got a heap block containing many UTF-8 strings, and I’m looking for the cheapest way to create NSString objects from them, i.e. without copying all the characters. -initWithBytesNoCopy:length:freeWhenDone: would be perfect, except that the string bytes are not an individual malloc block (s

Re: iOS "library" unit test of iOS code?

2017-04-24 Thread Jens Alfke
> On Apr 24, 2017, at 3:38 PM, Rick Mann wrote: > > I'm trying to test some code that's entirely stand-alone from my app, and in > fact I'm having trouble testing it within my app because the app does some > things that interfere. > > So, I tried creating a new test target and specifying "Non

Re: [OT] Question about writing documentation

2017-04-21 Thread Jens Alfke
One of my co-workers made a pretty nice class hierarchy diagram using an open source tool called PlantUML. https://en.wikipedia.org/wiki/PlantUML —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or

Re: Visible difference in text: NSTextField vs drawInRect:

2017-04-11 Thread Jens Alfke
> On Apr 11, 2017, at 9:49 AM, Gary L. Wade > wrote: > > If you need lightweight drawing, you could use an NSTextFieldCell, which > should give you some predictability. I don't recall the details, but there > are a number of things that NSTextField does (and NSTextView) that aren't > done wi

Re: Visible difference in text: NSTextField vs drawInRect:

2017-04-10 Thread Jens Alfke
That's weird. I think you'll need to do some detective work. - Break at runtime and check what the value of textField.font actually is. - Try using a different font and see if it makes any difference. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.ap

Re: Visible difference in text: NSTextField vs drawInRect:

2017-04-10 Thread Jens Alfke
> On Apr 10, 2017, at 7:41 AM, Navneet Kumar wrote: > > The image URL to a sample image: http://i63.tinypic.com/xbe0bc.jpg > > The top text is using a text field and bottom text is using drawInRect:. What are the exact text attributes? It looks as though the

Re: Normalisation of filenames

2017-04-01 Thread Jens Alfke
> On Apr 1, 2017, at 11:58 AM, Gerriet M. Denkmann wrote: > > I think that the examples above show, that NSURL does indeed do something > about normalising Unicode strings. That makes sense; I’d expect that one of the RFCs covering URLs describes normalization. Otherwise constructing URLs (fo

Re: Can't use +initialize, now what?

2017-03-29 Thread Jens Alfke
> On Mar 29, 2017, at 10:52 AM, Quincey Morris > wrote: > > If willFinishLaunching is not early enough, then you can put code in your > “main” function, but I don’t know how feasible that is in Swift. Another trick to run stuff earlier at launch is to add an -awakeFromNib method to your app

Re: Can't use +initialize, now what?

2017-03-29 Thread Jens Alfke
> On Mar 29, 2017, at 6:57 AM, Daryle Walker wrote: > > Sometimes, I see something in Apple’s AppKit/Foundation reference site that > mentions that their technique should be loaded early in the program by > putting it in the class’s “+initiallize” method. A +initialize method doesn’t necessar

Re: How to debug crash in NSOperation?

2017-03-27 Thread Jens Alfke
> On Mar 27, 2017, at 8:25 PM, Gerriet M. Denkmann wrote: > > > > Sent from my iPhone > > On 27 Mar 2017, at 23:37, Jens Alfke <mailto:j...@mooseyard.com>> wrote: > >> >>> On Mar 26, 2017, at 10:04 PM, Gerriet M. Denkmann >> <mailto

Re: How to debug crash in NSOperation?

2017-03-27 Thread Jens Alfke
> On Mar 26, 2017, at 10:04 PM, Gerriet M. Denkmann wrote: > > Yes, you are right. And I have to apologise for not spotting this: > > *** Terminating app due to uncaught exception 'NSInvalidArgumentException', > reason: '*** setObjectForKey: object cannot be nil (key: SortedKeys.plist)' I rec

Re: Official sidebar?

2017-03-25 Thread Jens Alfke
> On Mar 25, 2017, at 4:40 PM, Saagar Jha wrote: > > Nothing, if I remember correctly. Cocoa should handle window tabs for you. Isn’t there an API to manage them? For example, I use the tab bar in SourceTree to group multiple repositories into a single window, but every time I relaunch the a

Re: How do I set a NSTextView's font in Interface Builder?

2017-03-24 Thread Jens Alfke
> On Mar 24, 2017, at 11:28 AM, Keary Suska wrote: > > I don’t believe that is actually true. Attributes *can* apply to an empty > range. It may be that the serialized form of the string in the nib doesn’t preserve the attributes. Or that they’re not preserved by the view when the user types

Re: How do I set a NSTextView's font in Interface Builder?

2017-03-24 Thread Jens Alfke
> On Mar 23, 2017, at 6:35 PM, Daryle Walker wrote: > > I have the NSTextView selected in its storyboard scene. And I have the > Attributes Inspector active. The entry for the font is empty. Clicking the > squared-T gives a pop-up with a “Custom” font and changing it to one of the > fixed sel

Re: Unicode filenames with Apple File System and UIManagedDocument

2017-03-23 Thread Jens Alfke
> On Mar 22, 2017, at 2:25 PM, davel...@mac.com wrote: > > "Engineering has the following feedback for you: > > iOS HFS Normalized UNICODE names , APFS now treats all files as a bag of > bytes on iOS . We are requesting that Applications developers call the > correct Normalization routines to

Re: Opening custom files (iOS) from web

2017-03-20 Thread Jens Alfke
> On Mar 20, 2017, at 10:00 PM, Rick Aurbach wrote: > > BUT...what I want to do next is to click on a link on a webpage (i.e., an href=“”> element pointing to a ‘.poetry’ file) and have the file downloaded > and opened by my app. To be a little bit pedantic: it’s best not to think about thing

Re: Unicode filenames with Apple File System and UIManagedDocument

2017-03-20 Thread Jens Alfke
> On Mar 20, 2017, at 2:23 PM, davel...@mac.com wrote: > > NSURL *url = [[self courseDirectory] URLByAppendingPathComponent:name]; There’s nothing wrong with that call; it’s the canonical way to add a path component to a URL, filesystem or not. > NSURL *url = [NSURL fileURLWithFileSystemRepres

Re: why use extern "C"

2017-03-07 Thread Jens Alfke
> On Mar 7, 2017, at 8:45 AM, bigpig wrote: > > if there is C++ compiler and use C linkage,but if there isn’t C++ compiler > then use what? Then it’s a C compiler, which obviously uses C linkage. > And what is the reason of using this way in code? To make sure that the functions declared ins

Re: Unicode filenames with Apple File System and UIManagedDocument

2017-03-07 Thread Jens Alfke
> On Mar 7, 2017, at 8:13 AM, davel...@mac.com wrote: > >NSFileManager *fm = [[NSFileManager alloc] init]; >const char *data = [name fileSystemRepresentation]; >NSString *filename = [fm stringWithFileSystemRepresentation:data > length:strlen(data)]; This is a no-op, since you’re cal

Re: Unicode filenames with Apple File System and UIManagedDocument

2017-03-06 Thread Jens Alfke
> On Mar 6, 2017, at 3:45 PM, davel...@mac.com wrote: > > If I had the time and could easily do that, I would but pairing my app down > to just the minimal parts would be time consuming. Please at least file the bug report, even if you can’t include a reproducible case. It’s very important tha

Re: ncurses type wrapper for NStextview

2017-03-06 Thread Jens Alfke
> On Mar 6, 2017, at 1:43 PM, Julie Porter wrote: > > I was surprised that there seems to be no wrapper class to NSTextView to do > simple character cursor positioning equivalent to the Unix nCurses library. A word processor isn’t the same thing as a terminal. They have very different data mo

Re: macOS 10.13 suggestion for init() throws

2017-02-28 Thread Jens Alfke
> On Feb 28, 2017, at 11:56 AM, Daryle Walker wrote: > > The problem here is an interface mismatch where Swift has function > throw-ability status out-of-band from that function’s parameter list, while > Objective-C doesn’t. Only at the syntax level. Under the hood it works basically the same

Re: macOS 10.13 suggestion for init() throws

2017-02-28 Thread Jens Alfke
> On Feb 28, 2017, at 4:56 AM, Daryle Walker wrote: > > Could we have a NSDocument.init() that throws in the next macOS? That would > translate to a "initWithError" in Objective C (I think). It would be the new > primary initializer, with the current one calling it and dropping any error > to

Re: Memory-mapped sub-data?

2017-02-27 Thread Jens Alfke
> On Feb 27, 2017, at 10:02 AM, Chris Ridd wrote: > > It isn’t NSData, but libdispatch’s dispatch_data_t might be a useful way > forward. The dispatch_data_create(3) man page says it avoids "copying the > represented memory as much as possible.” There’s some kind of bridging between the two —

Re: Memory-mapped sub-data?

2017-02-27 Thread Jens Alfke
> On Feb 26, 2017, at 2:34 PM, Daryle Walker wrote: > > If I take a "subdata" of a memory-mapped (NS)Data, does it stay mapped (i.e. > use a range and reference)? Or does a full copy get made? I'm thinking of > making a parser be a sub-parser too, and this would make the difference > between

Re: Need replacement of Component Manager::OpenDefaultComponent

2017-02-24 Thread Jens Alfke
> On Feb 24, 2017, at 9:11 AM, sumit bansal > wrote: > > Can anyone please help me to find out the replacement of > Function => Component Manager::OpenDefaultComponent. That’s very generic; the Component Manager is/was just an ancient DLL-loading mechanism. IIRC it was mostly used by QuickTi

Re: Are instances of a NSManagedObject subclass usable as regular objects?

2017-02-14 Thread Jens Alfke
> On Feb 14, 2017, at 3:16 PM, Daryle Walker wrote: > > How do I give managed objects enough permanence to be used with systems > expecting normal objects? Managed objects are regular NSObjects and are ref-counted the same way. To keep one around, just use a regular strong reference. —Jens _

Re: Intercept Save when closing NSDocument

2017-02-10 Thread Jens Alfke
> On Feb 10, 2017, at 9:19 AM, Keary Suska wrote: > > I would start by overriding -saveDocument: and -saveDocumentAs: in your > NSDocument subclass with a breakpoint so I can see what is being done. Even easier: wait for the save dialog to appear, then hit the Pause button in the debugger and

Re: What generates NSURLErrorUnsupportedURL?

2017-02-08 Thread Jens Alfke
> On Feb 8, 2017, at 10:38 AM, Steve Christensen wrote: > > The time between when the request is made and when it completes with an error > might be a minute or so, so the framework is immediately bailing on the > request. I'm wondering what part of the process generates the error. Does the >

Re: Use WKSessionFile as Data for AVAudioPlayer?

2017-02-08 Thread Jens Alfke
> On Feb 8, 2017, at 5:48 AM, Eric E. Dolecki wrote: > > try self.player = AVAudioPlayer(contentsOf: file.fileURL!) Why are you trying to load it into memory? You want to avoid that if possible with media data. Just initialize AVAudioPlayer with the URL itself and let it strea

Re: Mobile Cross Platform Solutions

2017-02-08 Thread Jens Alfke
> On Feb 8, 2017, at 3:34 AM, Dave wrote: > > I’ve been asked to look at doing a Mobile App for a museum, basically the App > needs to show info (text, pictures and movies) for each exhibit. I’m > wondering the best way to make it work for iOS, Android and Windows Phone > (maybe). The content

Re: Use WKSessionFile as Data for AVAudioPlayer?

2017-02-07 Thread Jens Alfke
> On Feb 7, 2017, at 6:49 PM, Eric E. Dolecki wrote: > > Now, I want to instantiate an AVAudioPlayer and play that sent file. I know > that it's received (didFinish file transfer fires in the Watch Extension). > How do I do that? I don't know how to make that file Data. Can’t you just create th

Re: Xcode Framework wrapper for Library ( Exposing library headers)

2017-02-06 Thread Jens Alfke
> On Feb 6, 2017, at 2:46 PM, Mr steve davis > wrote: > > Thanks for the reply. However, it all seems to be in place. > > MyProject->'Ljnk Binary with Libraries’ = MyFramework > MyFramework->'Ljnk Binary with Libraries’ = libMyLibrary.a Ah — I think you are running into a linker ‘feature’ whe

Re: Xcode Framework wrapper for Library ( Exposing library headers)

2017-02-06 Thread Jens Alfke
> On Feb 6, 2017, at 2:04 PM, Mr steve davis > wrote: > > Undefined symbols for architecture x86_64: > "_OBJC_CLASS_$_MyLibrary", referenced from: > objc-class-ref in ViewController.o > ld: symbol(s) not found for architecture x86_64 This is a link error, not a compile error, so it has n

Predicate syntax for a conditional expression?

2017-02-06 Thread Jens Alfke
[Re-sending now that the lists are back up] Conditional NSExpressions (NSConditionalExpressionType) were added in 2015, but Apple’s predicate format syntax document* hasn’t been updated, so I can’t find any description of what the syntax is for them in a predicate string. By reverse-engineering

Re: PDF to Word ( docx) Conversion

2017-01-24 Thread Jens Alfke
> On Jan 24, 2017, at 12:58 PM, Peter Hudson wrote: > > I wondered about RTF - but I've built everything into a view and I can't see > a method on NSView to produce rtf. > I've done it previously with, I think, an NSText. I meant producing it programmatically. It’s a markup language, around

Re: PDF to Word ( docx) Conversion

2017-01-24 Thread Jens Alfke
> On Jan 24, 2017, at 11:54 AM, Peter Hudson wrote: > > But the bottom line is, I think, to get a Word doc that really behaves like a > Word doc ( in word ) I need to export straight to docx format. Have you tried exporting to RTF? It’s a simple text-based markup format, and imports well into

<    1   2   3   4   5   6   7   8   9   10   >