How can I make NSString.stringEncodingForData fail?

2016-05-29 Thread Daryle Walker
I'm about to test code that uses this method. My encodings are: ASCII, UTF-8, ISO Latin-1, then MacRoman. I think this covers all potential octet values. My "guard" blocks (I'm using Swift.) are for a 0 return and if the optional returned NSString can't be converted to a String. Can I cause som

Re: Simplest way to generate audio tones?

2016-05-29 Thread Graham Cox
Hi Jonathan, This turned out to be a great tip - thanks. I was able to port that iOS code straight to Mac without any problems and it pretty much worked first time. The audio session stuff turned out to be irrelevant to Mac, I just created the AU and away it went… —Graham > On 29 May 201

Re: Simplest way to generate audio tones?

2016-05-29 Thread Jens Alfke
> On May 28, 2016, at 8:24 PM, Graham Cox wrote: > > I’m looking for general pointers to the simplest/quickest way to generate an > audio tone (sine wave) of a given frequency and duration. Most of the audio > APIs seem concerned with playing samples rather than generating tones, so > it’s no

Re: When can String.enumerateSubstringsInRange ever pass in NIL?

2016-05-29 Thread Daryle Walker
Since I am using the substring and not including “.SubstringNotRequired”, I can just remove the “guard” block, tack on a “!” to substring’s identifier, and be done with it, right? — Daryle Walker Mac, Internet, and Video Game Junkie darylew AT mac DOT com > On May 29, 2016, at 12:08 AM, Ken T

Re: When can String.enumerateSubstringsInRange ever pass in NIL?

2016-05-29 Thread Quincey Morris
On May 29, 2016, at 19:16 , Daryle Walker wrote: > > Since I am using the substring and not including “.SubstringNotRequired”, I > can just remove the “guard” block, tack on a “!” to substring’s identifier, > and be done with it, right? The problem is there’s no API contract that says exactly

Re: NSDocument not displaying save prompt on dirty document

2016-05-29 Thread livinginlosangeles
Ok. The issue was that the auto-save prompt had disappeared when I was closing a dirty nsdocument. I added a nswindowcontroller to my nsdocument using addWindowController. I needed to add setShouldCloseDocument to my main nswindowcontroller, otherwise my document wouldn’t show the prompt. Patri

Re: When can String.enumerateSubstringsInRange ever pass in NIL?

2016-05-29 Thread Ken Thomases
On May 29, 2016, at 9:54 PM, Quincey Morris wrote: > > On May 29, 2016, at 19:16 , Daryle Walker > wrote: >> >> Since I am using the substring and not including “.SubstringNotRequired”, I >> can just remove the “guard” block, tack on a “!” to substring’s identifier, >