Re: NSAppKitVersionNumber wrong on latest Big Sur versions?!

2023-01-06 Thread Sean McBride via Cocoa-dev
On 6 Jan 2023, at 16:27, Rob Petrovec wrote:

> Yes, this is a bug that started in 11.7 that doesn’t appear to have been 
> fixed yet in 11.7.2.

Thanks for the confirmation.  Sad that such a serious regression wasn't fixed 
in 11.7.1 nor 11.7.2.

> Have you tried the arguably more robust and less error prone runtime checks 
> of:
>
> Swift
> if #available(macOS 10.16, *) {
>   // macOS 10.16 or later code path
> } else {
>   // code for earlier than 10.16
> }
>
> Objective-C
> if (@available(macOS 10.16, *)) {
>   // macOS 10.16 or later code path
> } else {
>   // code for earlier than 10.16
> }

I'm aware of them, tried switching once, but found that they did not work as 
expected, at least with older Xcodes.  The note I left in my code was:

TODO: "if (@available(macOS 11, *))" doesn't work properly!  It seems to only 
do the right thing if you use at least Xcode 12.2.

Seeing your example makes me wonder if "10.16" would have worked in place of 
"11"...

Sean
___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSAppKitVersionNumber wrong on latest Big Sur versions?!

2023-01-06 Thread Sean McBride via Cocoa-dev
Hi all,

On at least 3 Macs in my office, running macOS 11.7 or 11.7.2, 
NSAppKitVersionNumber (at runtime) is 2202.7 (sic).  This conflicts with 
NSApplication.h which has:

static const NSAppKitVersion NSAppKitVersionNumber11_0 = 2022;
static const NSAppKitVersion NSAppKitVersionNumber11_1 = 2022.2;
static const NSAppKitVersion NSAppKitVersionNumber11_2 = 2022.3;
static const NSAppKitVersion NSAppKitVersionNumber11_3 = 2022.4;
static const NSAppKitVersion NSAppKitVersionNumber11_4 = 2022.5;
static const NSAppKitVersion NSAppKitVersionNumber11_5 = 2022.6;

I had a macOS 11.2 installer lying around, and installed it in a VM, and there 
NSAppKitVersionNumber is 2022.3 as expected.

I can't help but note that 2202 looks like a typo vs 2022!

As 2202.7 is larger than NSAppKitVersionNumber12_0 (2113) it results in going 
into branches that should be Monterey-only.  Ouch.

Has anyone else observed this?

Thanks,

Sean
___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: dispatch_apply() on an NSArray and Thread Sanitizer

2022-04-25 Thread Sean McBride via Cocoa-dev
Well, to close this thread, for anyone curious...

I've tried on the same Mac, with the same Xcode version (13.2.1), on both macOS 
11.6.6 vs 12.3.1, and it seems to be the OS that makes the difference.  On 11, 
TSan correctly gives no error; but on 12 it gives this incorrect error about 
there being a data race.  I filed FB9995377.

Sean
___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: dispatch_apply() on an NSArray and Thread Sanitizer

2022-04-19 Thread Sean McBride via Cocoa-dev
On 19 Apr 2022, at 19:35, Rob Petrovec wrote:

> The docs for NSEnumerationConcurrent state that it is a hint and may be 
> ignored at run time.

Ah, so they do.  I had only checked in the header file.

OK, one less mystery.

Sean
___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: dispatch_apply() on an NSArray and Thread Sanitizer

2022-04-19 Thread Sean McBride via Cocoa-dev

On 19 Apr 2022, at 18:47, Saagar Jha wrote:

If Thread Sanitizer says your code has a race, it almost certainly has 
a race.


Yeah, that's been my general experience until now.

Your simple code seems OK superficially, but there are a couple things 
that could be problematic here: either your real code is actually 
mutating something, or (unlikely) you are touching some internal 
state, perhaps a CoW optimization, that is not visible to you but is 
silently changing things under the hood.


In case it wasn't clear, the code snippet in my email actually 
reproduces the issue.  I created a fresh Xcode project and it's 
literally just:


- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSArray* array = @[@5, @6, @7, @8, @9, @10, @11];

	[array enumerateObjectsWithOptions:NSEnumerationConcurrent 
usingBlock:^(NSNumber* num, NSUInteger idx, BOOL* stop) {

array[idx];
}];
}   

TSan complains with this on macOS 12.3.1 on an M1 Mac Mini with Xcode 
13.3.  But on an Intel Mac Pro, macOS 11.6.6 with Xcode 13.2.1, TSan 
does not complain.


In any case, I would generally suggest using -[NSArray 
enumerateObjectsAtIndexes:options:usingBlock:] with the 
NSEnumerationConcurrent flag, which should rule out any issues with 
concurrent access on the array itself.


I tried enumerateObjectsWithOptions:usingBlock: and TSan doesn't 
complain with it.  But I was suspicious of that and added an NSLog to 
print the index, and even after adding random sleeps:


	[array enumerateObjectsWithOptions:NSEnumerationConcurrent 
usingBlock:^(NSNumber* nub, NSUInteger idx, BOOL* stop) {

usleep(arc4random_uniform(100));
NSLog(@"idx: %d", idx);
array[idx];
}];

The thing is *not* running concurrently on the M1.  The indices are 
always printed in order.  Weird.


Sean
___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


dispatch_apply() on an NSArray and Thread Sanitizer

2022-04-19 Thread Sean McBride via Cocoa-dev
Hi all,

If one wants to do something with every item in an NSArray in a concurrent way, 
is the following safe/correct?


NSArray* array = @[@5, @6, @7, @8, @9, @10, @11];

dispatch_apply([array count], DISPATCH_APPLY_AUTO, ^(size_t idx) {
id unused = array[idx];
});


Here of course I'm not doing anything interesting, just extracting the object 
from the array.  This is a reduced example.

On one Mac I have, Thread Sanitizer says there is a data race there.  On 
another Mac, Thread Sanitizer does not complain.

My understanding is that this code is correct, and that TSan is wrong to 
complain, but maybe I'm wrong...

Thanks,

Sean
___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSPredicate: Using NSExpression CAST(x, 'Class') is deprecated and will be removed in a future release

2022-03-16 Thread Sean McBride via Cocoa-dev
On 18 Nov 2021, at 19:44, Sean McBride via Cocoa-dev wrote:

> Hi all,
>
> Starting in Monterey, I see a new message logged by Core Data during 
> persistent store migration:
>
> NSPredicate: Using NSExpression CAST(x,'Class') is deprecated and will be 
> removed in a future release. 'MyClassName' should not be cast into a Class 
> object.'
>
> This is due to my .xcmapping model where I set an attribute mapping to:
>
> FUNCTION(CAST("MyClassName", "Class"), "myMethodName:", 
> $source.myOldAttributeName)
>
> If this isn't correct, how can I invoke a custom method to transform an old 
> attribute into something new?

In case it helps anyone, my solution was to create an NSMigrationManager 
category and put my custom methods in there and then set the attribute mapping 
to this instead:

FUNCTION($manager, "myMethodName:", $source.myOldAttributeName)

Sean
___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSPredicate: Using NSExpression CAST(x, 'Class') is deprecated and will be removed in a future release

2021-11-18 Thread Sean McBride via Cocoa-dev
Hi all,

Starting in Monterey, I see a new message logged by Core Data during persistent 
store migration:

NSPredicate: Using NSExpression CAST(x,'Class') is deprecated and will be 
removed in a future release. 'MyClassName' should not be cast into a Class 
object.'

This is due to my .xcmapping model where I set an attribute mapping to:

FUNCTION(CAST("MyClassName", "Class"), "myMethodName:", 
$source.myOldAttributeName)

If this isn't correct, how can I invoke a custom method to transform an old 
attribute into something new?

Thanks,

Sean
___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to check signature and notarization?

2021-04-12 Thread Sean McBride via Cocoa-dev
On Mon, 12 Apr 2021 18:36:12 +0200, Gabriel Zachmann via Cocoa-dev said:

>Is there a way to check that the signature and notarization is proper?
>Are there any other checks I can do to determine what is going wrong?

You might find this helpful:



Sean


___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on ARC

2019-10-02 Thread Sean McBride via Cocoa-dev
On Wed, 2 Oct 2019 10:50:19 +1300, Sam Ryan via Cocoa-dev said:

>That was a good read, thank you for passing that on. It highlights a good
>point, that Apple is itself releasing applications with non-Mac UI (News,
>Home, Stocks, Voice Memos are mentioned in that article).

Another way to look at it: Apple is redefining what "Mac UI" is.  For better or 
worse.

Sean


___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTextField "Discard Change"

2019-04-09 Thread Sean McBride
On Sun, 7 Apr 2019 10:03:45 -0700, Quincey Morris said:

>Third, what I think you’re looking for is “discardEditing”, which is a
>part of the NSEditor protocol, to which NSTextField conforms.

A timely thread, as I'm investigating something quite similar, and was 
searching my email for 'commitEditing'.

NSTextField in fact does *not* support commitEditing/discardEditing, as per 
this a decade ago:

<https://lists.apple.com/archives/cocoa-dev/2008/Aug/msg00529.html>

I don't think I ever did find another solution to my problem other than to use 
an NSObjectController.

In my case, I'm wanting to commitEditing on a text field in the action method 
of a push button that consults the text field's value.

Cheers,

-- 
____
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada
___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Crash in terminate: on Mavericks

2019-01-21 Thread Sean McBride
On Fri, 18 Jan 2019 16:48:37 -0800, James Walker said:

>When my app runs in Mavericks (10.9.5), it crashes on quit, but in High
>Sierra it's fine.  The backtrace doesn't show any of my code, so I'm not
>sure how to proceed.  I don't suppose this means anything to anyone?

Have you tried ASan and TSan?  10.9 is even old enough to support valgrind I 
think.

Sean


___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Diagnosing memory problems

2018-11-27 Thread Sean McBride
On Tue, 27 Nov 2018 16:53:26 -0700, Rob Petrovec said:

>Actually, you want the Zombies tool.  That finds overreleased objects
>like ones that cause the spew you are seeing.

See also:

1) man guardmalloc

2) 

3) NSZombieEnabled

4) CFZombieLevel

Cheers,

Sean


___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to clear macOS app bundle cache

2018-09-07 Thread Sean McBride
On Mon, 3 Sep 2018 15:31:37 +0200, Andreas Falkenhahn said:

>Optimally, I'm looking for a solution to flush the app bundle cache on
>the iMac from the makefile that I run on the Mac Mini I use for building.

Not sure what "the app bundle cache" is, but maybe nuking the LaunchServices db 
would help?

Dump LS database:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister
 -dump > ~/lsdump.txt

Purge LS database:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister
 -kill -r -domain local -domain system -domain user


Cheers,

-- 
________
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada


___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Carbon -> Cocoa

2018-08-16 Thread Sean McBride
On Thu, 16 Aug 2018 11:54:59 +, Casey McDermott said:

>I am curious, are there other developers on this list working on conversions
>from C++ Carbon to Cocoa?

By now, Cocoa may be the new Carbon.

If you haven't switched to Cocoa after all these years, and if your app is 
large, I'd wait to see what happens with Marzipan.

Sean


___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: purpose of asking to access contacts

2018-06-13 Thread Sean McBride
On Wed, 13 Jun 2018 15:26:26 -0700, James Walker said:

>Oh, cool.  The " Information Property List Key Reference" seemed to 
>indicate in one place that it's only for iOS, but now I see another 
>place where it says macOS 10.8 and later.  Do you happen to know if it 
>works with the old AddressBook framework, or do I need to rewrite with 
>the CNContact stuff?

It works with the old AB framework.  I haven't even moved to the newer one yet, 
but I assume it works there too.

Cheers,

-- 
____
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada


___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: purpose of asking to access contacts

2018-06-13 Thread Sean McBride
On Wed, 13 Jun 2018 11:01:40 -0700, James Walker said:

>On iOS, you can give the user a hint of why you need access to contacts 
>by putting a purpose string in the Info.plist.  There isn't any way to 
>do that on macOS, is there?

There is: NSContactsUsageDescription in your Info.plist

Cheers,

Sean


___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Deleting files extremely slow since OSX High sierra

2018-04-25 Thread Sean McBride
On Mon, 23 Apr 2018 07:36:26 -0400, Mike Throckmorton said:

>Try replacing FSDeleteObject with [[NSFileManager defaultManager]
>removeItemAtPath: pth error: ];

Don't do that, it's sorta-deprecated too.  :)  You want removeItemAtURL:error:.

Sean


___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


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

2017-08-17 Thread Sean McBride
On Wed, 16 Aug 2017 18:39:56 -0500, Ken Thomases said:

>On Aug 16, 2017, at 6:29 PM, Sean McBride <s...@rogue-research.com> 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.
>
>It's quite old now, but the 10.6 AppKit release notes had a lot of good
>information about working with images in Cocoa viz. Core Graphics.  From
><https://developer.apple.com/library/content/releasenotes/AppKit/RN-
>AppKitOlderNotes/#X10_6Notes>, search for "NSImage, CGImage, and
>CoreGraphics impedance matching" and read from there.
>
>They also have advice about what you're trying to do.  The advice is to
>*not* try to interpret an arbitrary image rep's bitmap data.  It's to
>make a bitmap with the format you desired and draw the source image into
>it.  Then, you have bitmap data in the format you want, for sure.  For
>that, search for "NSBitmapImageRep: CoreGraphics impedance matching and
>performance notes".

Thanks, that's quite helpful!  I know I've read it before, but forgot to 
recheck those release notes, they sure are great, I'm glad Apple writes them!

I also found 'QA1509: Getting the pixel data from a CGImage object' which is 
even older, but was useful too.

I also found vImageBuffer_InitWithCGImage() which has been great!

So my typical data is 1280x1024.  With NSBitmapImageRep I can't get it into an 
NSData in 30 ms, whereas with CGImageCreateWithJPEGDataProvider() + 
vImageBuffer_InitWithCGImage() it takes only 9 ms and produces byte-for-byte 
identical results interestingly enough.  I suspect bitmapData makes a copy 
somewhere.

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada


___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


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

2017-08-16 Thread Sean McBride
On Tue, 15 Aug 2017 10:07:47 -0700, Doug Hill said:

>>> Check out CoreImage ColorControls filter, which has a Saturation parameter:
>> 
>> Thanks Doug and Jonathan for the CIImage suggestion, I'll take a
>closer look.  But one thing I don't see at all in CIImage.h is how to
>get an NSData of the pixels of a CIImage.  There are init methods that
>take NSData, but nothing I see gives NSData.
>> 
>> I should note that I have no need to draw this data whatsoever.  I
>only need access to the raw pixels to do some custom processing on.
>
>NSBitmapImageRep can be created from a CIImage, and has methods for
>creating an NSData version of the bitmap, or just getting the bitmapData
>and/or data planes.

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.

Cheers,

-- 
____
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada


___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


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

2017-08-15 Thread Sean McBride
On Tue, 15 Aug 2017 09:41:25 -0700, Doug Hill said:

>Check out CoreImage ColorControls filter, which has a Saturation parameter:

Thanks Doug and Jonathan for the CIImage suggestion, I'll take a closer look.  
But one thing I don't see at all in CIImage.h is how to get an NSData of the 
pixels of a CIImage.  There are init methods that take NSData, but nothing I 
see gives NSData.

I should note that I have no need to draw this data whatsoever.  I only need 
access to the raw pixels to do some custom processing on.

Cheers,

-- 
____
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada


___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Decompressing JPEG data into specific format, getting raw pixels

2017-08-15 Thread Sean McBride
Hi all,

I get some JPEG data from the network.  I want to efficiently decompress this 
data into a specific format (8 bit greyscale) and have an NSData of the raw 
pixels.  What's the best way to do this?

I'm currently using NSBitmapImageRep initWithData:, then testing if the result 
is greyscale or RGB.  If the latter, I write my own loop to convert to 
greyscale.

But I'm hoping there is some lower level API available that I can tell 
explicitly that I want greyscale...

Thanks,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada


___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Exact definition of NSView/NSEvent coordinate system origin?

2017-08-11 Thread Sean McBride
On Fri, 11 Aug 2017 11:53:10 -0500, Ken Thomases said:

>> I know 0,0 is the bottom-left, but is it:
>> - the centre of the bottom-left pixel?
>> - the bottom-left corner of the bottom-left pixel?
>
>It's the bottom-left corner of the bottom-left pixel.

Playing around with NSRectFill() that indeed seems to be the case, thanks.

I assume it's the same for screen, window, and layer coordinates, surely?

>Depending on what you're doing, you should more or less ignore the
>fractional part.  At some point, Apple started supporting high-
>resolution mouse positions.  Since then, the mouse is almost never at an
>integral position.

Ah, found this in the 10.1 (sic) AppKit Release Notes: "-[NSEvent 
locationInWindow] may now return NSPoints with non-integral coordinates to 
represent sub-pixel precision generated by some input devices..."

Presumably these are also corner-pixel based?

>> Then there's the 'locationInWindow' docs, that say "Note: The y
>coordinate in the returned point starts from a base of 1, not 0." 
>That's quite odd.  Why?
>
>I believe for compatibility with what was originally a bug.  When
>converting from the Core Graphics coordinate space, where the origin is
>at the top left, to the Cocoa coordinate space, where it's at the bottom
>left, somebody did pt.y = primaryScreenHeight - pt.y.  That's correct
>for an infinitely-small point.  However, for a pixel, it's not.  On a
>single-screen system and with integral-pixel positions, pt.y can range
>from 0 to primaryScreenHeight - 1, inclusive.  That means that
>(primaryScreenHeight - pt.y) can range from primaryScreenHeight to 1,
>inclusive.  The correct code would have been pt.y = primaryScreenHeight
>- 1 - pt.y, but it's too late to fix it now.

Right, classic off-by-1 error. :)

Doing the following in mouseDown: is idiomatic:

NSPoint viewPoint = [self convertPoint:[inEvent locationInWindow] 
fromView:nil];

but it's not clear to me if convertPoint:fromView: expects the off-by-1 value 
from locationInWindow or not.

It seems to work correctly the idiomatic way, that is, if I use Pixie to zoom 
and carefully click the corner pixel in my NSView, the 'viewPoint' is always 
some fraction between 0 and 1 in both x and y.  I would have expected to be 
off-by-1 in y

Cheers,

Sean


___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Exact definition of NSView/NSEvent coordinate system origin?

2017-08-11 Thread Sean McBride
Hi all,

I'm tying to understand the exact definition of the Cocoa drawing and event 
coordinate system on macOS.  In particular the exact location of 0,0 and 
subpixel accuracy.

I know 0,0 is the bottom-left, but is it:
 - the centre of the bottom-left pixel?
 - the bottom-left corner of the bottom-left pixel?

I made a custom NSView and implemented mouseDown:

- (void)mouseDown:(NSEvent*)inEvent {
NSPoint viewPoint = [self convertPoint:[inEvent locationInWindow] 
fromView:nil];

I then use Pixie.app at max magnification and click the bottom-left pixel, 
yielding results like:

(lldb) p viewPoint
(NSPoint) $3 = (x = 0.15234375, y = 0.90625)

So it's giving fractional values, but they are hard to interpret without 
knowing where 0,0 is exactly.

Then there's the 'locationInWindow' docs, that say "Note: The y coordinate in 
the returned point starts from a base of 1, not 0."  That's quite odd.  Why?

Does anyone know the exact details here?

Thanks,

-- 
____
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada


___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSWindow non-integer point sizes? (on Retina dispays)

2017-07-01 Thread Sean McBride
On Fri, 30 Jun 2017 19:29:54 -0500, Ken Thomases said:

>> Does anyone know what NSWindow's initWithContentRect: behaviour is
>with non-integer contentRect?  The docs don't say.  It seems that, on a
>retina display, window size can only be an even number of pixels (ie an
>integer number of points).
>
>I have experience with this and have seen the same behavior as you.  A
>window's size and position are restricted to integral points.  If you
>pass a non-integral rect, it will be expanded outward to be integral.

Thanks for the confirmation!  That's mostly what I was looking for posting 
this...  Now off to radar to suggest better docs.

>I suspect that this is for the situation where a system has a
>combination of Retina and non-Retina displays.  You don't want dragging
>a window from one to the other to change its size.

Ah, that's a good point, and plausible theory.

>If your window is borderless, you can make it transparent and have a
>fractional-size view (subview of the contentView) do the base opaque
>drawing, thereby effectively setting the size of the window.

Thanks for the suggestion, though in this case I need a regular window with 
title bar and all.

Cheers,

Sean


___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSWindow non-integer point sizes? (on Retina dispays)

2017-07-01 Thread Sean McBride
On Fri, 30 Jun 2017 11:00:40 -0700, Quincey Morris said:

>On Jun 30, 2017, at 10:26 , Sean McBride <s...@rogue-research.com> wrote:
>> 
>> Does anyone know what NSWindow's initWithContentRect: behaviour is
>with non-integer contentRect?
>
>Not really, but is there a reason why you can’t just try it?

Obviously I tried. :)  I guess I could have been clearer, but it's what I meant 
by: "It seems that, on a retina display, window size can only be an even number 
of pixels (ie an integer number of points)."

(It was hard to try mind you, since Quartz Debug doesn't seems to support 
retina simulation on hardly any Mac models in my office. :()

Cheers,

Sean
___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSWindow non-integer point sizes? (on Retina dispays)

2017-06-30 Thread Sean McBride
Hi,

Does anyone know what NSWindow's initWithContentRect: behaviour is with 
non-integer contentRect?  The docs don't say.  It seems that, on a retina 
display, window size can only be an even number of pixels (ie an integer number 
of points).

(I ask because I have some cross-platform OpenGL-based code that wants to 
create windows of odd pixel count size.  I figure it's not possible, but 
thought I'd check here...)

Thanks,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada


___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using Quartz Debug to simulate Retina display broken?

2017-04-07 Thread Sean McBride
On Thu, 6 Apr 2017 18:43:21 -0500, Kyle Sluder said:

>Quartz Debug’s capabilities are tied pretty closely to your specific
>hardware configuration, which for your model of Mac in particular can
>vary widely. Please take a sysdiagnose and file a bug report.

I've now tried on a MacPro4,1, MacPro5,1, MacBook6,1, MacMini7,1, and it 
doesn't work on any of them.  I did get one HiDPI choice on an iMac11,1.  Well, 
this sucks.

Cheers,

-- 
____
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada
___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Using Quartz Debug to simulate Retina display broken?

2017-04-06 Thread Sean McBride
Hi all,

It's been a few years since I tried to simulate a Retina display on my 
non-Retina monitor.  I used Quartz Debug (version 4.2 (182)) as described here:

<https://developer.apple.com/library/content/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Testing/Testing.html>

and despite letting it log me out, there are no "HiDPI" options available in 
System Preferences > Displays.  I'm on 10.12.4 on a MacPro5,1.  

Anyone used this successfully recently?

Thanks,

-- 
________
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada


___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Seeing nil passed to isEqual:, despite non-null declaration

2017-01-13 Thread Sean McBride
On Fri, 13 Jan 2017 10:51:18 -0800, Jens Alfke said:

>So Quincey is actually correct — isEqual: has unspecified nullability,
>and the header is not in error.

I'd say the header is in error in the sense that it should have nullability 
specified.  Quite surprising that it's not done by now.

Cheers,

-- 
____
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Seeing nil passed to isEqual:, despite non-null declaration

2017-01-13 Thread Sean McBride
On Fri, 13 Jan 2017 10:43:09 -0800, Ben Kennedy said:

>> Did I miss a change in clang that made the default “not nullable”?? I
>read the above declaration as meaning that the nullability is
>*unspecified*, which implies that nil is allowed.
>
>NSObject.h (from which Sean was quoting) begins with
>NS_ASSUME_NONNULL_BEGIN which, to my understanding, makes everything in
>the file be non-nullable unless otherwise annotated.

I was going to say the exact same, but in fact usr/include/objc/NSObject.h does 
*not* contain NS_ASSUME_NONNULL_BEGIN, which I find quite surprising!  
Foundation's NSObject.h *does* however.  What a mess.

Cheers,

-- 
________
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Seeing nil passed to isEqual:, despite non-null declaration

2017-01-13 Thread Sean McBride
On Fri, 13 Jan 2017 09:53:25 -0800, Jens Alfke said:

>So yes, the parameter should be declared as `nullable`.

Thanks, 

Sean



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Seeing nil passed to isEqual:, despite non-null declaration

2017-01-13 Thread Sean McBride
Hi all,

NSObject.h declares:

- (BOOL)isEqual:(id)object;

Note the parameter is not nullable.  And yet, I'm seeing nil passed to one of 
my class's overrides of isEqual: when I invoke Edit>Undo.  Backtrace:

#4  -[RRLookupTable isEqual:]
#5  -[NSManagedObject(_NSInternalMethods) _updateFromUndoSnapshot:] ()
#6  -[NSManagedObjectContext(_NSInternalChangeProcessing) _undoInsertions:] 
()
#7  -[_NSUndoStack popAndInvoke] ()
#8  -[NSUndoManager undoNestedGroup] ()
#9  _os_activity_initiate ()
#10 -[NSApplication(NSResponder) sendAction:to:from:] ()
#11 -[NSMenuItem _corePerformAction] ()
#12 -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] ()
#13 _os_activity_initiate ()
#14 -[NSMenu performKeyEquivalent:] ()
#15 routeKeyEquivalent ()
#16 -[NSApplication(NSEvent) sendEvent:] ()
#17 -[NSApplication run] ()
#18 NSApplicationMain ()
#19 main

Anyone ever seen nil passed to isEqual:?  Is the SDK declaration maybe wrong?

Thanks,

-- 
____
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: 12 hr vs 24 hr time display

2017-01-03 Thread Sean McBride
On Tue, 3 Jan 2017 11:26:48 -0500, Sandor Szatmari said:

>What I was asking for clarity on is the fact that there is no way to
>detect that the user prefers 24 hr time display if they only choose
>method 1, the Date & Time checkbox.  Should I allow my users to set 12
>hr time but override it to 24 hr time if the Language & Region checkbox
>is checked?  This doesn't feel right.  I feel like Apple left room for
>ambiguity in their design here.

If I were you I would just forget about the setting for the menu bar clock.  I 
agree it's weird that it even exists (file a bug) but it's clearly meant only 
for the menu bar clock.  Just use NSDateFormatter and add some UI in your app 
showing the user the proper place to set her preferred date/time format options.

Cheers,

-- 
________
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

How to know if an NSFont can draw an NSString?

2016-12-09 Thread Sean McBride
Hi all,

I use an open source OpenGL-based library to do some drawing, and sometimes I 
need to draw some text.  This library takes UTF-8 as input and a path to a font 
file to use.  I use [NSFont systemFontOfSize:0.0] and get its path using 
kCTFontURLAttribute.

This all works great for many characters, but notably fails for Japanese 
characters (and others).  I'm trying to understand why.  Could it be that the 
system font doesn't have every unicode character under the sun?  If so, is 
there a way to choose an NSFont based on the contents of an NSString?

Thanks,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Elementary NSUserDefaults Question

2016-12-07 Thread Sean McBride
On Wed, 7 Dec 2016 11:24:24 -0500, Charles Jenkins said:

>Originally I did store bookmarks back when my app allowed users to pick
>background music from their music libraries. But I could find no way to
>play bookmarked library music at a low background volume, so I abandoned
>that and just began using a .wav file stored with the app’s resources. If
>anyone knows how to play music from the library at a low volume, without
>screwing up the system volume for other apps, e.g. Music.app, I’d love to
>learn it.

I'm not sure I follow.  I don't know hardly anything about audio playback, but 
converting between bookmarks/paths/URLs is pretty trivial as they all are 
basically different representations of the same concept.  If you can do audio 
playback from a path then doing so for a bookmark is just a matter of 
converting your bookmark to a path.

Cheers,

-- 
____
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Elementary NSUserDefaults Question

2016-12-07 Thread Sean McBride
On Wed, 7 Dec 2016 10:25:46 -0500, Charles Jenkins said:

>When the app starts up, we call NSUserDefaults.standard.register( [ “bgm” :
> ) to default to the real file name, so the user will hear

Charles,

It's also best practice not to store file names/paths, but instead to store 
"bookmarks".  See NSURL's 
bookmarkDataWithOptions:includingResourceValuesForKeys:relativeToURL:error:.

Cheers,

-- 
________
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Preserving knowledge of renamed/moved directory?

2016-11-28 Thread Sean McBride
On Mon, 28 Nov 2016 17:06:41 -0800, Rick Mann said:

>Back in the days before URLs, I could have an FSRef to a directory, and
>no matter where I moved that directory what I named it, the FSRef was
>still valid, and I could still read/write to it.
>
>Now that everything is URL based, if a thread changes the name of a
>directory, or moves it, another thread's URL pointing to that directory
>(or inside it) becomes invalid, right?
>
>Is there any way for this to not be the case? That is, for a URL to a
>directory or subdirectory or item within to stay valid even if the path
>to it changes?

Stay valid for how long?  If you need to persistent them, use them across 
reboots, etc. see 
bookmarkDataWithOptions:includingResourceValuesForKeys:relativeToURL:error.

Cheers,

-- 
____
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Why does default NSDateFormatter in IB ignore thousands separator?

2016-11-04 Thread Sean McBride
On Wed, 2 Nov 2016 11:10:00 -0700, Quincey Morris said:

>> Why on Earth does a default NSNumberFormatter ignore the user's
>choice?  Am I alone thinking this is buggy?
>
>Going from memory, I think I ran into this too, once. IIRC, the problem
>is that one of the necessary parameters (e.g. the separator character,
>the number of digits per group) doesn’t default to the system settings,
>so that the formatter *would* show the grouping but it thinks it can’t.

Thanks for confirming my sanity. :)  I guess it's off to Radar again...

 Default NSNumberFormatter created in IB fails to honour 
thousands (aka group) separator
 "Attributes inspector" for NSNumberFormatter should default 
to larger number for "sample input" 

Quite a shame, as most developers probably just figure the default number 
formatter is the right thing to use, I'd wager that most apps out there are in 
fact not rendering numbers in proper localized format. :(

>FWIW, here’s the code I use to get a formatter to show separators (not
>via IB, obviously), but this combination of non-default parameters
>works, at least:
>
>>  formatter = [[NSNumberFormatter alloc] init];
>>  formatter.formatterBehavior = NSNumberFormatterBehavior10_4;
>>  formatter.usesGroupingSeparator = YES;
>>  formatter.locale = [NSLocale currentLocale];
>>  formatter.groupingSize = 3;
>
>(The fact that I did this in code may also reflect the fact that I gave
>up trying to do it in IB.)

My app shows a lot of numbers, doing this in code would require creating so 
many new outlets.  :(  ex: Searching my xibs for "usesGroupingSeparator="NO"" 
gives 129 results.

>The fact that the IB file seems to say there’s no grouping may not be
>significant. IB may have figured out that one required setting is
>missing, so disabling the grouping completely might be an effect, not a cause.

In fact, a search & destroy of "usesGroupingSeparator="NO"" and 
"groupingSize="0"" in the xib seems to fix the problem for me.  I'll probably 
go with that "solution".

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Why does default NSDateFormatter in IB ignore thousands separator?

2016-11-02 Thread Sean McBride
Hi all,

If I drag a default NSNumberFormatter from IB's 'object library' into my xib 
and wire it to an NSTextField my numbers don't display the thousands separator. 
 The "localize format" checkbox is checked by default; the tooltip for that 
checkbox says thousands separators should be applied.

Looking at the .xib in a text editor, the formatter is represented as:

 

I guess the "usesGroupingSeparator="NO"" explains things. :)

In 'System Preferences > Language > Advanced > General' there is a 
setting to choose the thousands separator, mine is set to 'space'.

Why on Earth does a default NSNumberFormatter ignore the user's choice?  Am I 
alone thinking this is buggy?

Thanks,

-- 
________
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Success with NSTableView weak delegates?

2016-09-20 Thread Sean McBride
On Tue, 20 Sep 2016 16:41:07 -0700, Greg Parker said:

>Those crashes are expected. 
>
>NSTableView's delegate is zeroing-weak when both of the following are true:
>* Your app was built with the 10.11 SDK or newer.
>* Your app is running on 10.12 or newer.
>
>The delegate is unsafe-unretained when running on 10.11 and earlier, no
>matter what SDK you built with.

Ah ha, thanks!  That WWDC video is quite misleading then.  I was about to 
lament the lack of any better docs, but now realize that it's actually nicely 
documented here in the 10.12 release notes:
<https://developer.apple.com/library/content/releasenotes/AppKit/RN-AppKit/index.html>

So sorry for the noise!

Thanks David & Greg!

Cheers,

-- 
________
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Success with NSTableView weak delegates?

2016-09-20 Thread Sean McBride
On Tue, 20 Sep 2016 14:26:27 -0700, David Duncan said:

>> On Sep 20, 2016, at 1:21 PM, Sean McBride <s...@rogue-research.com> wrote:
>> 
>> Hi all,
>> 
>> WWDC 2016 Session 203 "What's New in Cocoa" at around 43:37 in the
>video, says that if you link against the 10.11 SDK that NSTableView's
>delegate is weak.  So I went and wrapped my delegate nil-ing in:
>> 
>> #if MAC_OS_X_VERSION_MAX_ALLOWED < 101100
>>  [tableView setDelegate:nil];
>>  [tableView setDataSource:nil];
>> #endif
>> 
>> yet (with NSZombie especially), I easily reproduce message-to-zombie
>crashes with builds that are made against the Xcode 7.3.1 10.11 SDK.
>
>On which OS version?

At runtime: 10.9.5, 10.10.5, and 10.11.6.

>The macro above only says “do this if I link against an SDK prior to
>10.11” – that doesn’t handle what happens at runtime when you are on
>10.10 or below. In particular, if you plan to deploy back to prior to
>10.11, then you would want to either do a runtime check, or for trivial
>code like this always run the code until your MIN_ALLOWED (deployment
>target) is >= 10.11.

Yes, I'm aware of these differences.  I'm also aware, as you surely are, that 
sometimes behaviour depends (only) on what SDK you link against.

If you scrub to around 43:37 here:
<https://developer.apple.com/videos/play/wwdc2016/203/>

you'll see they specifically refer to "linked on 10.11".

Besides, I both build and run on 10.11.6 and yet I see these message-to-zombie 
crashes after removing the setDelegate:nil code.

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Success with NSTableView weak delegates?

2016-09-20 Thread Sean McBride
Hi all,

WWDC 2016 Session 203 "What's New in Cocoa" at around 43:37 in the video, says 
that if you link against the 10.11 SDK that NSTableView's delegate is weak.  So 
I went and wrapped my delegate nil-ing in:

#if MAC_OS_X_VERSION_MAX_ALLOWED < 101100
[tableView setDelegate:nil];
[tableView setDataSource:nil];
#endif

yet (with NSZombie especially), I easily reproduce message-to-zombie crashes 
with builds that are made against the Xcode 7.3.1 10.11 SDK.

Anyone have success with these supposedly weak tableview delegates?

Thanks,

-- 
____
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Drawing issue with translucent borderless NSWindow, initial content half stays

2016-09-07 Thread Sean McBride
On Tue, 30 Aug 2016 21:03:20 -0500, Ken Thomases said:

>On Aug 30, 2016, at 10:10 AM, Sean McBride <s...@rogue-research.com> wrote:
>> 
>> I have a drawing bug in my app, and reduced it to a toy app. 
>Basically, I create an NSBorderlessWindowMask type window who's content
>view draws a translucent rounded rect.  Its only subview is an
>NSTextField that draws a number in a big font.  When I display the
>window, all is well.  But when I change the textfield text, or even
>simply remove the textfield, its old string half remains in a ghostly
>outline.  This works in 10.9 and 10.10, but is buggy in 10.11 and
>10.12.  I figure it's an OS bug, but maybe the description rings any
>bells for anyone?
>
>Does the window have a shadow?  Are you invalidating the shadow whenever
>the content gets redrawn (since the shadow of a partially-transparent
>window depend on exactly what was drawn non-transparently)?

Ken,

That was exactly it, thanks!  A call to invalidateShadow did it!

Cheers,

-- 
____
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Drawing issue with translucent borderless NSWindow, initial content half stays

2016-08-30 Thread Sean McBride
Hi all,

I have a drawing bug in my app, and reduced it to a toy app.  Basically, I 
create an NSBorderlessWindowMask type window who's content view draws a 
translucent rounded rect.  Its only subview is an NSTextField that draws a 
number in a big font.  When I display the window, all is well.  But when I 
change the textfield text, or even simply remove the textfield, its old string 
half remains in a ghostly outline.  This works in 10.9 and 10.10, but is buggy 
in 10.11 and 10.12.  I figure it's an OS bug, but maybe the description rings 
any bells for anyone?  Code is here is someone cares to look...:

<https://www.rogue-research.com/BackgroundBug.zip>

Thanks,

-- 
____
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: awakeFromFetch behaviour change in 10.12?

2016-08-12 Thread Sean McBride
On Mon, 25 Jul 2016 21:09:09 -0400, Sean McBride said:

>>> I'm observing that in 10.12 my awakeFromFetch methods are being called
>>> more than in 10.11 and earlier.  Specifically, it's called more than once
>>> for an object that's already been fetched previously.
>>
>>This does not sound like expected behavior. Could you please file a bug
>>report at https://bugreport.apple.com and attach a sample project if at
>>all possible?
>
>Kyle,
>
>Thanks for agreeing that it seems wrong.  I filed  but
>haven't reduced to a test app yet.
>
>Also, for the archives: I got something backwards in my post: the
>problem happens if I fetch with returnsObjectsAsFaults=NO (not YES).

For the archives again: they've fixed it in 10.12b5.

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: awakeFromFetch behaviour change in 10.12?

2016-07-25 Thread Sean McBride
On Mon, 25 Jul 2016 14:12:42 -0500, Kyle Sluder said:

>On Mon, Jul 25, 2016, at 09:14 AM, Sean McBride wrote:
>> Hi all,
>> 
>> I'm observing that in 10.12 my awakeFromFetch methods are being called
>> more than in 10.11 and earlier.  Specifically, it's called more than once
>> for an object that's already been fetched previously.
>> 
>> Perhaps I have misunderstood the method's semantics all these years, but
>> I expected that awakeFromFetch would only be called once, when an object
>> is first awaken from the persistent store.
>> 
>> Now I'm seeing that if I execute a fetch request where
>> returnsObjectsAsFaults=YES awakeFromFetch will be invoked on all the
>> resulting objects, even if it'd been invoked before.
>> 
>> Does that seem correct to you?
>
>This does not sound like expected behavior. Could you please file a bug
>report at https://bugreport.apple.com and attach a sample project if at
>all possible?

Kyle,

Thanks for agreeing that it seems wrong.  I filed  but haven't 
reduced to a test app yet.

Also, for the archives: I got something backwards in my post: the problem 
happens if I fetch with returnsObjectsAsFaults=NO (not YES).

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

awakeFromFetch behaviour change in 10.12?

2016-07-25 Thread Sean McBride
Hi all,

I'm observing that in 10.12 my awakeFromFetch methods are being called more 
than in 10.11 and earlier.  Specifically, it's called more than once for an 
object that's already been fetched previously.

Perhaps I have misunderstood the method's semantics all these years, but I 
expected that awakeFromFetch would only be called once, when an object is first 
awaken from the persistent store.

Now I'm seeing that if I execute a fetch request where 
returnsObjectsAsFaults=YES awakeFromFetch will be invoked on all the resulting 
objects, even if it'd been invoked before.

Does that seem correct to you?

Thanks,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Exact semantics of NSThread executation states?

2016-07-12 Thread Sean McBride
Hi all,

NSThread has at least 3 execution state properties: executing, finished, 
cancelled.  Alas, the docs don't say much about what they mean beyond circular 
definitions like "A Boolean value that indicates whether the receiver is 
executing".

I have code where I create an NSThread, add a runloop source, then invoke 
"start" on the thread.  I have assumed that once I invoke "start" that 
"isExecuting" should give YES.  Literally:

[myThread start];
assert([myThread isExecuting]);

On 10.11.5 and earlier this *seems* to always be true, but on 10.12b2 it's not. 
 I'm trying to understand if my assumption was wrong or if it's an OS bug.

Thanks,

-- 
________
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSTableView is messaging zombie delegate

2016-05-09 Thread Sean McBride
On Fri, 6 May 2016 13:28:10 -0700, Jens Alfke said:

>> On May 6, 2016, at 1:03 PM, Matthew LeRoy <mle...@minitab.com> wrote:
>> 
>> My understanding is that NSTableView's delegate is a zeroing weak reference
>
>Are you sure? Historically it’s been unsafe_unretained — in the old days
>before weak references or ARC, the view never retained nor released the
>delegate. The type of crash you’re having was a not-uncommon bug.
>
>Apple may have upgraded the property to a proper zeroing weak reference,
>but I can’t tell from the docs.

I was going to say "no", because my bug's still open, but in fact I never filed 
one. :(  The following are still "open" (including their duped-to originals) 
though:

24046976 / 21380125 NSSplitView's delegate should be weak not assign
21366070 / 18987740 NSAnimation delegate should be 'weak' not 'assign'
17553217 NSSpeechRecognizer delegate should be 'weak' not 'assign'
17540574 NSToolbar's delegate should be 'weak' not 'assign'
17540533 NSWindow's delegate should be 'weak' not 'assign'
15301393 / 10520557 Support zeroing weak references (under ARC) with NSTextView

As for NSMenu, it came back: "Although the delegate is declared “assign” in 
NSMenu.h, it’s actually been weak (for weak-compatible objects) since 10.9."

When switching from GC to ARC, all this was a PITA.

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: BOOL parameter passed as nil object

2016-04-18 Thread Sean McBride
On Mon, 18 Apr 2016 18:56:43 -0700, Carl Hoefs said:

>Suppose I have an object with a declared method signature:
>  -(void)myMethod:(BOOL)a_bool;
>
>Q1: If I invoke it like this:
>  [self performSelector:@selector(myMethod:) withObject:nil];  // nil obj

Stop right there, you are violating the documentation of the API:

"aSelector should identify a method that takes a single argument of type id. 
For methods with other argument types and return values, use NSInvocation."

Is there still no compiler warning for this? :(

Cheers,

-- 
____
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Alternatives to NSMatrix that uses bindings similar to NSMatrix's bindings

2016-04-07 Thread Sean McBride
On Thu, 7 Apr 2016 15:36:51 -0400, Nivek Research said:

>I have a number of NSMatrix instances that group radio buttons. Most
>bind the selectedIndex or selectedTag bindings available on NSMatrix to
>a numeric value in a model object. The others bind the contentObjects
>and selectedObject binding available on NSMatrix. As NSMatrix is
>informally deprecated in OS X 10.8 and later does anyone know a way to
>bind multiple NSRadioButtons to a single numeric value as was once done
>with selectedIndex or selectedTag such that the selected radio button
>follows the numeric value? Similarly does anyone have a way to bind
>multiple buttons to a single object value like NSMatrix’s selectedObject
>was used previously? Ideally any solution should be backwards compatible
>to OS X 10.6 as I still need to support that release. I have searched
>the internet though I have not seen a solution that will work without
>major changes to my model code. Not that I am not willing to make the
>changes. I just wonder if anyone has been enlightened with a cooler solution.

Kevin,

Yeah, I keep meaning to file a radar about this.  I didn't find any nice way to 
do this, so I'm mostly still using NSMatrix for radio buttons.  Recently, I 
wrote a little helper class, attached here, that makes it a little easier to 
use bindings with non-NSMatrix radio buttons.  It's not as nice as NSMatrix's 
built-in IB support, but maybe you'll find it helpful.

Cheers,

-- 
________
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada
//
// RRRadioBinder.h
//
// Created on 2016-01-08.
// Copyright Rogue Research 2016. All rights reserved.
//
// This file is encoded as UTF-8.
//
// $Id: RRRadioBinder.h 31325 2016-01-13 21:23:49Z sean $

/*! \class RRRadioBinder
 \brief Instances of this class can be used to bind together an integer and a 
group of radio buttons using Cocoa bindings. It's a replacement for the 
deprecated NSMatrix and its 'selectedTag' binding.  Should be instantiated in a 
nib file, with an outlet connecting it to controller to bind to and a 'user 
defined runtime attribute' named 'bindingKeyPath' set to a keypath of the 
controller. Observation is started in awakeFromNib and stopped in dealloc. */

#import 

NS_ASSUME_NONNULL_BEGIN

@interface RRRadioBinder : NSObject

/// The controller to bind to.
@property (readwrite, weak, nonatomic) IBOutlet NSController* bindingController;

/// The keypath of the controller to observe.
@property (readwrite, copy, nonatomic) NSString* bindingKeyPath;

/// The radio buttons to manage. At least 2 should be connected for non-trivial 
usage. They should all have the same action methed, namely handleRadioButton:.  
They should all have different tags.
@property (readwrite, weak, nonatomic, nullable) IBOutlet NSButton* 
radioButton0;
@property (readwrite, weak, nonatomic, nullable) IBOutlet NSButton* 
radioButton1;
@property (readwrite, weak, nonatomic, nullable) IBOutlet NSButton* 
radioButton2;
@property (readwrite, weak, nonatomic, nullable) IBOutlet NSButton* 
radioButton3;
@property (readwrite, weak, nonatomic, nullable) IBOutlet NSButton* 
radioButton4;

/// The action method that all radio buttons should be connected to.
- (IBAction)handleRadioButton:(id)inSender;

@end

NS_ASSUME_NONNULL_END


RRRadioBinder.m
Description: Binary data
___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Can an NSArray ever have a count of -1?

2016-02-19 Thread Sean McBride
On Fri, 19 Feb 2016 14:29:03 -0800, Jens Alfke said:

>(Here’s one reason NSInteger sucks: the difference in sizes doesn’t make
>sense for values that don’t refer to memory sizes. For example, is it OK
>use NSUInteger to store a file size? In a 64-bit process, sure! In a 32-
>bit one, you’ll be fine until you encounter a file > 4GB long, then you
>overflow and get the size wrong.

Which is why API that deal with file sizes don't use NSUInteger.  It doesn't 
mean NSInteger sucks, it's just a 'right tool for right job' kind of thing.

Cheers,

-- 
________
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: App Transport Security exceptions App Store signed app

2016-01-27 Thread Sean McBride
On Tue, 26 Jan 2016 22:18:45 -0800, Jens Alfke said:

>Also, have you looked into setting up HTTPS on those servers instead of
>working around its absence? Part of the reason Apple added ATS was to
>nudge app developers to make their network connections more secure,
>which will benefit users.

Someone should nudge Apple's Server.app team then, because its apache still 
supports only TLSv1.0, rather laughably! :(

Cheers,

-- 
____
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: applicationSupportDirectory access for admin and standard users

2015-12-21 Thread Sean McBride
On Mon, 21 Dec 2015 22:16:39 +, Jonathan Mitchell said:

>My app seems to be having trouble reading and writing to the
>applicationSupportDirectory depending on whether the logged in user is
>an admin or standard user.
>I don’t use the sandbox.
>
>NSURL *appSupportDir = [[NSURL alloc] initFileURLWithPath:
>[[NSFileManager defaultManager] applicationSupportDirectory] isDirectory:YES];
>
>Is there anything I need to be aware of here?

What's "trouble"?  What error code do you get trying to write to the directory?

Cheers,

-- 
____
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Best way to get a file path for presentation to the user

2015-12-19 Thread Sean McBride
On Sat, 19 Dec 2015 19:51:03 +1100, Graham Cox said:

>I don’t think a NSPathControl is really appropriate for this.

I'm curious why... that's what it's for.

Cheers,

-- 
____
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: FSIsAliasFile deprecated - typeOfFile is slow

2015-11-27 Thread Sean McBride
On Fri, 27 Nov 2015 23:00:16 +0100, Leonardo said:

>The problem is that the IsAliasNew method is 3.7 times slower than the
>IsAliasOld method. Do you know a way to accomplish that with a faster
>method?

Maybe try NSURL's getResourceValue:forKey:error: with NSURLIsAliasFileKey.

Cheers,

-- 
____
Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Private Methods

2015-08-18 Thread Sean McBride
On Tue, 18 Aug 2015 08:58:22 -0600, Richard Charles said:

Apple documentation states that the Names of most private methods in
the Cocoa frameworks have an underscore prefix (for example, _fooData )
to mark them as private.”

I just ran into a case where one of my method names in a subclass
replaced a private Cocoa framework method of the same name causing my
application to crash in the next version of OS X. The private Cocoa
framework method name did not have an underscore prefix. So the
documentation is correct, “most” but not all private methods in the
frameworks have an underscore prefix.

I'm not even sure most is true.  A large number of Apple methods do not start 
with underscore.

I have never bothered doing this because for one reason BF_addObject
looks so ugly as a method name.

Me neither.  I've hit only a few conflicts over the years, in which case I 
rename.

You can set the OBJC_PRINT_REPLACED_METHODS env var to help catch conflicts.  
Always a good idea with beta version of major OS releases.

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Private Methods

2015-08-18 Thread Sean McBride
On Tue, 18 Aug 2015 23:23:00 +0800, Maxthon Chan said:

My own preference is to prefix private methods with underscores and the
project’s class prefix.

That's exactly what you should not do.

Like the OP said, Apple's docs say that they reserve things starting with 
underscore for themselves.

Also, the C and C++ languages also reserve names that start with underscore and 
uppercase.  See ex:

http://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-a-c-identifier

If you're going to use a prefix: don't start with underscore!

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Sharing Prefs between Main and Helper App

2015-08-16 Thread Sean McBride
On Wed, 12 Aug 2015 15:50:35 -0600, Alex Kac said:

I have an OS X app signed with Developer ID. It is NOT sandboxed (I
suppose I could, but I'd prefer to stay away from that for a bit
longer).

I need my helper and main app to share prefs. There must be a simple
way to do this for now. I know that initWithSuite works with App
Groups and sandbox…but again I don't want to be sandboxed just yet.

I suspect initWithSuite works without App Sandbox too...

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSManagedObject, NSString property retain vs copy

2015-08-01 Thread Sean McBride
On Fri, 31 Jul 2015 12:15:10 +0200, Jean-Daniel Dupas said:


 Le 30 juil. 2015 à 18:26, Fritz Anderson fri...@manoverboard.org a écrit :
 
 On 30 Jul 2015, at 11:03 AM, Trygve Inda cocoa...@xericdesign.com wrote:
 
 It seems Apple is using retain rather than copy for NSString properties in
 an NSManagedObject subclass.
 
 I was always under the impression that copy should be used for NSString, so
 why the retain??
 
 For an immutable string, -copy is implemented as a -retain. -copy is a
guard against the receiver’s relying on the unchanging contents of a
string whose contents can be changed. If the contents cannot in fact be
changed, there’s no point in allocating new memory and copying the bytes
into it.
 
 It’s an implementation detail; what makes you believe it makes a difference?

If it is in the property declaration, it is not an implementation
detail, it is part of the public API.

And as the receiver can’t guarantee that a passed NSString is not a
NSMutableString under the hood, it should always declare property as
copy, so the fact that some sample code (I guess this is what the op is
talking about) use retain is dubious.

This has long been a weakness in the Core Data ecosystem.  Even mogenerator 
does not have an option to make things 'copy':
https://github.com/rentzsch/mogenerator/issues/41

I might take a stab at that next week...

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Back-to-back NSOpenPanel runModal blocking each other

2015-06-30 Thread Sean McBride
On Tue, 30 Jun 2015 20:17:29 +, Quincey Morris said:

In the dialog APIs that have a completion handler, there’s a free
‘orderOut:’ after the handler returns, if it didn’t do that already. I’d
assume that this is is what’s internally causing the ‘orderOut:’ to
happen later than you wish, and of course you have no direct control
over this.

Calling orderOut: myself (right after runModal) doesn't actually order the 
window out either. :(

Possible workarounds:

1. Don’t use a loop, but rather than a chain of dispatches. That is, put
the prompt code in a block that takes some parameters, and at the end of
the block do a dispatch_async (dispatch_get_main_queue (), …) of the
block with some new parameters. This should queue your next dialog after
a block that’s been queued to do the ‘orderOut:’, which will defer the
new dialog until the old one is gone. (This is basically your ‘sleep’
workaround, but without any delay.)

2. Use ‘beginWithCompletionHandler:’ instead of ‘runModal’. The only
downside is that it’s not modal, so the dialog could get hidden by other
windows of your app, if the user clicks on the wrong thing.

Thanks for the suggestions.  The difficulty will be that this old code really 
requires the synchronous nature of runModal, as the found NSURL must be 
returned up to the calling function.  Really I should get around to cleaning it 
all up one day... :)

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Back-to-back NSOpenPanel runModal blocking each other

2015-06-30 Thread Sean McBride
Hi all,

Should I be able to display one NSOpenPanel after another using runModal?

Basically, I have a loop where I prompt users to manually find files when 
alias/bookmark resolution fails.  I use the synchronous API runModal which 
displays a modal NSOpenPanel and returns only when the user has pressed 
OK/Cancel.  However, the panel itself doesn't always actually get visually 
removed from the screen before my loop spins around again and displays another 
open panel.  When that occurs, the new one gets shown *under* the old one, but 
the old one can't be interacted with and the new one is thus blocked.  If I 
throw in a sleep(1) before showing a second one, things work as desired.

Should what I'm trying to do work?

Thanks,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Back-to-back NSOpenPanel runModal blocking each other

2015-06-30 Thread Sean McBride
On Tue, 30 Jun 2015 20:50:06 +, Quincey Morris said:

On Jun 30, 2015, at 13:41 , Sean McBride s...@rogue-research.com wrote:
 
 Calling orderOut: myself (right after runModal) doesn't actually order
the window out either. :(

Is this app sandboxed?

No.

If so, I wouldn’t expect that to do anything,
since that’s not the window that’s onscreen. It’s in another process.

Maybe these days it's even in another process for non-sandboxed apps...

 this old code really requires the synchronous nature of runModal

'sleep (1)' sounds good.

Oh rather: good enough. :)

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: recycleURLs with authorization

2015-06-17 Thread Sean McBride
On Thu, 18 Jun 2015 08:16:48 +0700, sqwarqDev said:

Hi list

I'm trying to move some files to the trash with my app, but I need OS X
to throw an authentication dialog when the requested file needs
permission to be moved. 

I need a solution that will work from 10.6 onwards, so I've been looking
at NSWorkspace's recycleURLs rather than NSFileManager's trashItemAtURL
(not available pre 10.8).

My problem is that recycleURLs doesn't appear to offer an option to ask
the user for a password if it's needed. Is there another method I can
use that will, or a way to make recycleURLs throw the dialog? I know I
could probably run an NSTask and call rm but that's a bit more brutal
than what I'm looking for. I'd like the user to actually see the file in
the Trash and to know that they've authorised its removal.

You should look at the SMJobBless sample code, which I think is the current way 
to do things:

https://developer.apple.com/library/mac/samplecode/SMJobBless/Introduction/Intro.html

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Language options: Objective-C, Swift, C or C++?

2015-06-15 Thread Sean McBride
On Fri, 12 Jun 2015 23:51:42 -0700, Britt Durbrow said:

Swift is too immature to warrant doing anything serious with it yet…

I've stayed away from it for that reason basically.  When Xcode x+1 can't even 
compile code that builds in Xcode x, I'm not too interested (except for toy 
projects).  Yeah, I know there's a code migrator, but then god help you if 
Xcode x.y+1 has some regression and you need to go back to x.y, which has 
happened to me more times than I care to count.

Some stability in the language is needed before I use it for big/serious 
projects.

Personally, if I had the time to dedicate to it, I’d come up with some
non-critical project (i.e, something not “serious”, but big enough to
qualify as “non-trivial) to do in Swift for the purpose of developing
that skill set.

Exactly.  In my case, the new automated UI testing in Xcode 7 looks like the 
perfect opportunity to write some initial Swift code.

The open sourcing of Swift is also vital.  I wouldn't use it otherwise.  There 
are just too many great tools in the llvm ecosystem that would be excluded 
otherwise.  Things like clang-format, address sanitizer, etc that all support 
Obj-C thanks to it being in clang (otherwise those tools would only support 
C/C++ I'm sure).

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: iOS version check

2015-06-12 Thread Sean McBride
On Fri, 12 Jun 2015 17:46:52 +, Quincey Morris said:

I wonder what the best practices are here. It’s possible that this
situation is anomalous, because the API didn’t change, nor the range or
intended meaning of the value being passed. (The speech rate was wrong
in iOS 8 even if you didn’t set the rate explicitly.) It was just a bug
fix. Perhaps checking the generic system version is the only solution.

Yes, I think so.  I've had to fall back on that kind of check sometimes.

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: 3D file formats

2015-06-12 Thread Sean McBride
On Thu, 11 Jun 2015 17:05:42 -0700, Rick Mann said:

Preview and QuickLook are able to show me the .obj files my company
creates. But neither SceneKit nor Xcode seem to be able to open them, at
least not directly. OS X 10.10.3 (for eventual use on iOS).

Is there any way to leverage the support I see in Preview/QuickLook in
my own apps?

QuickLook has public API, QLPreviewView looks like what you want.

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Going back to non-ARC

2015-06-12 Thread Sean McBride
On Fri, 12 Jun 2015 18:18:48 +1000, John Brownie said:

Having worked with ARC code for a long while, I discovered an 
incompatibility with a library that means I have to convert to non-ARC 
code.

That sounds like a bad idea.  One could easily imagine that non-ARC will be 
deprecated one day, just like garbage collection was.  Probably better to 
direct your energy to fix the nano library.  Strange though, because it seems 
to me ARC offers good C++ interoperability as described here:

http://clang.llvm.org/docs/AutomaticReferenceCounting.html

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: iOS version check

2015-06-12 Thread Sean McBride
On Fri, 12 Jun 2015 05:23:08 +, Quincey Morris said:

but there’s no definition of NSFoundationVersionNumber_iOS_9_0 in the
iOS 9 SDK.

On OS X at least, they usually don't add them until the next OS version.

In fact, there’s nothing higher than
NSFoundationVersionNumber_iOS_8_1 in the iOS 9 SDK. That means there’s
no definition that lets me test against 8.2, 8.3 or 8.4.

It's possible Foundation didn't actually change in those releases.

Also, AVSpeechUtterance isn't in Foundation, so checking the Foundation version 
is dubious.

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: IB_DESIGNABLE - anyone got it to work?

2015-05-12 Thread Sean McBride
On Tue, 12 May 2015 16:43:32 +1000, Graham Cox said:

I’m exploring the use of the new IB_DESIGNABLE macro to preview a custom
view live in IB.

It keeps complaining that my view is taking too long to draw, over
200mS, which seems to be a limit built into IB. However, when I measure
the time myself for drawing, it’s nowhere near this long - 10mS max,
typically 2mS. Because of this constant and apparently erroneous
complaint, IB doesn’t show my custom view. I’ve even tried to do some
minimal drawing (just filling the dirty rect) for just the Interface
Builder target, but I get the same problem, so it’s pretty clear that
the timeout is nothing to do with my drawing.

At other times IB complains that the rendering agent “crashed”, though
it’s actually an exception from the bowels of Core Graphics. My usual
drawing code never triggers the same exception, only when it’s drawn by
the IB rendering agent.

Has anyone been able to make this work?

After some difficulty, yes.  But it seems to only support direct subclasses of 
NSView, not NSControl for example.  What's your superclass?

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Core Data sync between iOS and Mac apps

2015-05-07 Thread Sean McBride
On Thu, 7 May 2015 10:57:05 -0400, Michael Swan said:

On OS X NSPersistentDocument can only make flat files, not packages like
UIManagedDocument (I've filed a bug about there being no counterpart to
UIManagedDocument for OS X, been open for over a year now…).

Only a year?  Mine's been open for 3 years now.  Duped to rdar://9447453 
which is still open too.

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Creating new/untitled NSPersistentDocuments from template documents?

2015-05-01 Thread Sean McBride
On Fri, 1 May 2015 13:36:49 -0500, Steve Mills said:

Can’t you just set the document’s url to nil at some point? That’s what
I do in readFromURL:ofType:error: after reading the file (actually
before reading, because I don’t access the url again from the document).
I’m using regular NSDocument, but I’d still expect it to work with
NSPersistentDocument.

Steve,

Thanks for your reply.

Seems that does not help.

In my NSPersistentDocument subclass I created a new initializer, which stripped 
of error checking, is basically:

- (instancetype)initWithTemplate
{
self = [super init];

[self readFromURL:hidden file in my .app

ofType:@com.rogue-research.foobar
 
error:error];
  [self setFileURL:nil]; // seems to change nothing

  return self;
}

Indeed I get what looks like a new/untitled document and it has the correct 
contents from the template file.  When I save I get a save panel and supply a 
filename for example on the Desktop but then it tries to save to my template 
anyway with an exception:

 NSUnderlyingException = Cannot update objects into a read only store.;

readFromURL: seems to have added my template as a persistent store in the 
persistent store coordinator. :(

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Creating new/untitled NSPersistentDocuments from template documents?

2015-05-01 Thread Sean McBride
Hi all,

I have an NSPersistentDocument-based application.

I'd like to be able to create new/untitled/unsaved documents that are 
pre-populated with various managed objects.  Instead of creating the objects 
programatically, I'd like to load them from a template document (hidden inside 
my .app).  It's mostly working, but everything I try seems to keep some 
connection to the hidden template document's URL.

Any suggestions on a kosher way to do this?

Thanks,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: UTI case doesn't matter sometimes?

2015-04-13 Thread Sean McBride
On Mon, 13 Apr 2015 14:09:06 -0500, Steve Mills said:

So, should string comparisons be case-insensitive when comparing UTIs?
If not, then things fail.

Don't compare as strings, use UTTypeConformsTo().

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Does GCD auto-limit concurrent tasks to number of cores?

2015-04-09 Thread Sean McBride
On Thu, 9 Apr 2015 14:40:16 -0500, Ken Thomases said:

If some of your tasks are blocked (due to I/O or locks or even sleeps),
then you may have more tasks in flight than there are cores, because the
blocked tasks don't consume CPU capacity.  This can actually be a
problem if you have tasks which are mixed I/O and computation, because
GCD will over-subscribe the CPU.  When the tasks unblock, there are more
tasks wanting CPU than there are cores.

As much as possible, use dispatch I/O or dispatch sources for I/O.  Keep
tasks segregated to doing either I/O or computation, not a mix.  If you
can't use dispatch I/O or sources, then try to self-limit the number of
I/O tasks in flight at once (for example by submitting them to a serial
queue or low-concurrency-limit NSOperationQueue per device).  Once you
do that, you should be safe to submit large numbers of CPU tasks and let
GCD manage them.

Not just IO, but memory usage too.  If you have 24 cores, and GCD spins up 24 
simultaneous 'tasks', and each needs 2 GB of RAM, then you better hope you have 
48 GB of RAM too, or you'll swap and easily end up dog slow.

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Proper switching and casing.

2015-04-09 Thread Sean McBride
On Thu, 9 Apr 2015 17:05:57 -0400, Alex Zavatone said:

Sorry that I sent this before the main observation.

Considering the implications of this, should Xcode's compiler flag these
unbreak-ed case statements with a warning?   Currently, it doesn't do that.

-Wimplict-fallthrough

Is there any reasonable case where you'd want a case condition to not
have a break statement after it?

Yes, but not often IMHO.

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Where is my bicycle?

2015-04-06 Thread Sean McBride
On Mon, 6 Apr 2015 11:36:38 -0500, Charles Srstka said:

Objective-C doesn’t support Unicode in source files (although Swift does).

Yes it does, and it has for many years too.

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Number formatter errors

2015-04-01 Thread Sean McBride
On Wed, 1 Apr 2015 13:33:15 +1100, Shane Stanley said:

I start a new project, then drag a text field with attached number
formatter into the window. I set the formatter's minimum to 0 and
maximum to 1. I run, then enter 3 and hit return. I get a beep, but no
error dialog. Yet I have existing projects where a dialog appears. I'm
sure I'm missing something simple, but it's escaping me. Any hints?

Do you have 'validates immediately' on?

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

View-based tableview and outlets to NSFormatters

2015-04-01 Thread Sean McBride
Hi all,

I swear this was discussed, but can't find it in the archives...

It seems Interface Builder won't let me connect the 'formatter' outlet of a 
textfield that's within a view-based tableview to a top-level formatter that 
lives in the same nib.  It complains:

 Unsupported Configuration: Outlet 'formatter' of 'Text Field Cell - Table 
View Cell' is connected to 'Date Formatter,' an invalid destination (Objects 
inside view based table views may only be connected to the table view's 
delegate.)

I often have top-level formatters in my nibs, ex: a number formatter configured 
to show exactly 2 decimal places.  Then I have a bunch of textfields (some in 
tables, some not) that connect to it.

How can I do this with view-based tables?

It seems I could:

1) drag a formatter in IB to each table cell.  Downsides: I risk their settings 
becoming out-of-sync with each other.  Also, formatters are supposedly 
expensive to create.

2) implement the tableView:viewForTableColumn:row: delegate method to set the 
formatter.  Downsides: need to write code; most of my tables use bindings and I 
often don't have a delegate; need to assign column identifiers and switch on 
them.

Is there no better way?

Thanks,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: windowDidLoad not getting called

2015-03-19 Thread Sean McBride
On Thu, 19 Mar 2015 21:21:30 +, Quincey Morris said:

— Never, ever use “visible at launch” on any window that has a window
controller.

That'd be a nice thing to assert() in my window controllers... but I just don't 
see any getter for it... :(

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: removeObserver:forKeyPath:context: fails; but removeObserver:forKeyPath: works?!

2015-03-12 Thread Sean McBride
On Wed, 11 Mar 2015 23:28:08 +, Quincey Morris said:

— I don’t think it’s a very good idea to do this (slightly abbreviated
from your source):

 - (void)bind:(NSString*)inBindingName toObject:(id)inObservableObject
withKeyPath:(NSString*)inKeyPath  options:(NSDictionary*)inOptions {
  [inObservableObject addObserver:self  forKeyPath:inKeyPath options:0
context:context];
  [super bind:inBindingName toObject:inObservableObject
withKeyPath:inKeyPath options:inOptions];
 }

The standard implementation of bindings, which you’re using when you
invoke super, *also* adds the exact same observation as you just did
(though with a different or nil context, presumably).

When you invoke super in ‘unbind', I guess it’s using the context-less
form of removeObserver.

Thanks for your analysis; I concur with it.

Not using bindings isn't an option, at least not in the short/medium term.  The 
app was started back when we had ibplugins and uses bindings heavily.

Regarding your prescriptions, I was going to say 'but I'm doing it just as 
mmalc's old binding examples suggested' but then I went to look up the old 
BindingsJoystick sample code and see that it was updated in 2012, which I never 
noticed.  I swear they changed how they do things.  Now bind: and unbind: only 
call super if the binding name is not the class' own, and now they implement 
infoForbinding:.  My SCM history shows that unconditionally calling super was 
necessary for ibplugins to work properly, which is moot now.

So I guess my solution is to only call super in bind: and unbind: for binding 
names that aren't mine, and to also override infoForBinding: to return info for 
my own bindings, and again only call super for super's bindings.

Thanks!

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: removeObserver:forKeyPath:context: fails; but removeObserver:forKeyPath: works?!

2015-03-11 Thread Sean McBride
On Wed, 11 Mar 2015 21:06:46 +, Jonathan Mitchell said:

I recently refactored my app to use removeObserver:forKeyPath:context:
rather than removeObserver:forKeyPath and it went without a hitch.

We did the same refactor a couple of years ago, and it went great also.  We 
missed just one or two, and as per Murphy's Law one is being problematic. :)

are you using for your context pointers? Mine are always non nil
pointers to a static char.

Likewise.

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: removeObserver:forKeyPath:context: fails; but removeObserver:forKeyPath: works?!

2015-03-11 Thread Sean McBride
On Tue, 10 Mar 2015 18:25:23 +, Quincey Morris said:

If something else is using a conflicting ‘removeObserver:forKeyPath:’,
it might sorta work if all observers use it (because the total number of
removals is equal to the number of observations, even if they remove
each others’ observations), but fail if some try use
‘removeObserver:forKeyPath:context:’ on an observation that’s already
been removed.

It must be something like that.  I've gutted my app down to test case size and 
it still reproduces. :(  If you're curious I can put it online.

Also, a long time ago (Leopard-ish), there was a horrible bug where
observations of (from?) the same thing could get mixed up so that
attempting to remove one would actually remove the other. I doubt this
was ever fixed — it was subtle.

The Foundation Release Notes speak of similar things being fixed... but maybe 
there is another bug...

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: removeObserver:forKeyPath:context: fails; but removeObserver:forKeyPath: works?!

2015-03-11 Thread Sean McBride
On Wed, 11 Mar 2015 20:24:34 +, Quincey Morris said:

Sure, I’d be interested to see it.

Cool, thanks.  It's here:

https://www.rogue-research.com/RemoveObserverBug.zip

To repro:
 - search for all the NSLogs in the project (4 of them) and put breakpoints 
there
 - build  launch
 - you may need to do File  New to get the window to appear
 - the window has 3 custom views. bind is called from windowDidLoad
 - press the top push button (it mutates an NSManageObject)
 - watch the logs, each of the 3 views will observe the change
 - press the bottom push button (it unbinds and removes 2of3 views)
 - watch the logs
 - press the top push button again

Expected:
 - the remaining view should have observed the change

Actual:
 - the remaining view does not even get into observeValueForKeyPath

Notes:
 - if you toggle the #if in the unbind: implementation you can fix the bug

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

removeObserver:forKeyPath:context: fails; but removeObserver:forKeyPath: works?!

2015-03-10 Thread Sean McBride
Hi all,

Can anyone think of a sitation where using removeObserver:forKeyPath: works 
correctly, then modernizing the code to use removeObserver:forKeyPath:context: 
breaks things?

Long story: I have a custom NSView subclass that exposes a custom binding.  In 
bind: it does addObserver:forKeyPath:options:context:.  In unbind: it does 
removeObserver:forKeyPath:.  If I update unbind: to use the 'context' version 
it breaks.

Specifically, if I have several of these views onscreen (all bound to the same 
NSObjectController) then remove all but one of the views from the view 
hierarchy, the remaining one no longer receives any KVO notifications.  I've 
put logs everywhere, and subclassed NSObjectController and implemented 
addremoveObserver methods to log and call super.  All the log output is the 
same in the working  broken cases except the deliberate difference between 
using removeObserver: with or without the context.  I am surprised to see this 
backtrace however:

-[MyObjectController removeObserver:forKeyPath:]
-[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:context:] 
()
-[NSController removeObserver:forKeyPath:context:] ()
-[MyObjectController removeObserver:forKeyPath:context:]
-[MyView unbind:]
...

Odd that NSObjectController removeObserver:forKeyPath:context: calls 
removeObserver:forKeyPath:, no?

Any clues would help... :)

Thanks,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Converting from scalar to NSNumber*

2015-02-27 Thread Sean McBride
On Fri, 27 Feb 2015 16:28:58 -0800, Rick Mann said:

I'm updating some older Core Data code in which I made liberal use of
transient properties to map NSNumber* types to scalar types like
uint32_t. In practice, this doesn't gain much, especially with boxing
syntax, and it makes the Core Data classes messier (shadow attributes, etc.).

The problem is, if I change an attribute's type to NSNumber*, and fail
to modify every reference to that attribute, I often end up comparing
pointers, not values:

@property (strong) NSNumber*   someAttribute;

if (obj.someAttribute  42)

Also watch out for booleans, where:

  if (obj.someAttribute)

won't get any warning, whether it's BOOL or id.

Also if you use mogenerator, it will automatically create methods for you named 
setSomeAttributeValue: and someAttributeValue, which take scalars.

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Updating Mapping Model after changing schema

2015-02-26 Thread Sean McBride
On Thu, 26 Feb 2015 17:00:49 -0800, Rick Mann said:

A problem I run into a lot with automatic migration using a Mapping
Model is that I'm usually in the process of making incremental changes
to my schema. So I create a Mapping Model, modify it as necessary, and
things are fine.

But then if I change the schema again, that Mapping Model is not found.
In this case, I added some optional attributes to an Entity, and so the
Mapping Model no longer matches.

But if I try to add attribute mappings for those new attributes, I
can't. The Mapping Model editor only lets me choose from a set of
destination attributes, and it doesn't show any of the new ones.

I can create a new Mapping Model that picks those up, but then I lose
the customizations I've done, which can be quite tedious and error-prone
to reproduce.

Does anyone have a solution for this? TIA,

Xcode menu bar: Editor  Refresh Data Models.  Or maybe I misunderstand what 
you want...

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

[JOB] Looking for Mac Cocoa dev in Montréal, Canada

2015-02-21 Thread Sean McBride
Hi all,

The company I work for is looking to hire a developer to join our team to work 
on our Cocoa neuroscience research application Brainsight.

https://www.rogue-research.com/job_openings.html

Responsibilities:
- Assist in the design, development, maintenance, and testing of the Brainsight 
neuronavigation software.
- Implement new features in our application; add new test suites.
- Maintenance of our existing Cocoa application and its test suites.
- Participate in design activities and code reviews with team members.
- Improve and debug existing code; write new code.

Requirements:
- Solid understanding of object oriented programming (OOP).
- Experience with OOP languages (ex: Objective-C, C++, Java, etc.).
- Experience with C-based languages (C, Objective-C, C++).
- At least 1 year experience programming professionally.
- Experience with source control systems, particularly svn.
- Able to work both in a group and independently.
- Knowledge of UNIX-like environments, particularly Mac OS X.
- Work on-location in Montréal, Québec, Canada (no telecommuting).
- Need legal right to work in Canada.

Desirable/Useful:
- Experience with Mac OS X, Cocoa, Xcode, Objective-C, C, and C++.
- Bachelor in Computer Science/Engineering or similar.
- Knowledge of linear algebra  3D transformations.
- Knowledge of OpenGL.
- Knowledge of VTK and ITK open source libraries.
- Familiarity with iOS.
- English/French bilingual.

Job Benefits:
- Work with a small, creative team.
- Work in a nice loft-style office in a central location in Montreal.

To apply:
- email your CV to c...@rogue-research.com

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: ARC dealloc best pratice

2015-02-10 Thread Sean McBride
On Fri, 6 Feb 2015 12:46:44 -0800, Jens Alfke said:

Come to think of it, I'm surprised that AppKit delegates are still
unsafe-unretained. Why haven't these been converted to safe weak
references yet?

The 'why' has been answered, but worse it's not even clear sometimes what a 
delegate's situation is.  Take NSTableView.h in the 10.10 SDK:

-
/* Get and set the delegate. The delegate can implement methods in the protocol 
NSTableViewDelegate. All delegate methods are optional. The delegate is a weak 
reference (non retained) in non garbage collected applications. Under garbage 
collected apps, it is a strong reference. The default value is 'nil'.
 */
- (void)setDelegate:(id NSTableViewDelegate)delegate;
- (id NSTableViewDelegate)delegate;
-

So based on Greg saying We prefer to reserve the term 'weak' for safe zeroing 
weak. I guess for NSTableView there's no need to nil the delegate.  OTOH, my 
experience converting my GC app to ARC says the exact opposite.  Without 
clearing the delegate to nil in say windowWillClose, I get sporadic crashes.

What's the true situation for NSTableView?

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: GC / ARC question regarding screensavers under Mavericks

2015-01-16 Thread Sean McBride
On Sun, 4 Jan 2015 02:31:50 +0100, Gabriel Zachmann said:

Could it be that System Preferences does still expect screen savers to
be compiled with garbage collection?

Probably.  You can check if an app is built with GC using this:

http://stackoverflow.com/questions/3129925/how-can-i-determine-if-a-compiled-objective-c-app-is-using-garbage-collection

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Cursor above siblings

2015-01-09 Thread Sean McBride
On Fri, 9 Jan 2015 14:56:09 -0700, Keary Suska said:

It may have changed but my recollection is that interaction with
overlapping views is undefined.

No, it's been well-defined since 10.5, though the docs are of course still not 
updated rdar://11805856.  I've also seen some cases where drawing order is 
wrong when layer hosting/backing is involved rdar://11852080.  

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSURL resourceValuesForKeys NSURLPathKey

2015-01-08 Thread Sean McBride
On Thu, 8 Jan 2015 16:31:18 -0800, Trygve Inda said:

I call:

NSData* bookmarkData = [url
bookmarkDataWithOptions:NSURLBookmarkCreationMinimalBookmark
includingResourceValuesForKeys:nil
relativeToURL:nil
error:inError];

And later:

NSDictionary* dict = [NSURL resourceValuesForKeys:[NSArray
arrayWithObject:NSURLPathKey] fromBookmarkData:[self bookmark]];
if (dict)
{
 path = [dict objectForKey:NSURLPathKey];
}

Path ends up with the correct value even though I passed nil above...

When it resolves or fails to resolve?  Probably only the former.

includingResourceValuesForKeys:nil

Is this documented behavior?

Dunno, but it reminds me of this:
http://lists.apple.com/archives/cocoa-dev/2012/Oct/msg00299.html

I think I should be putting NSURLPathKey in the call to create the bookmark,
but it does seem to work without it. Thoughts?

I would put it.

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: ARC query

2015-01-07 Thread Sean McBride
On Wed, 7 Jan 2015 12:02:16 -0600, Ken Thomases said:

Short answer: yes, the alert is retained.

Meaning that one must use the weak/strong dance pattern like this?

NSAlert *alert = [NSAlert new];
alert.alertStyle = NSWarningAlertStyle;
alert.messageText =  @“Do not touch!;
__weak NSAlert* weakAlert = alert;
[alert beginSheetModalForWindow:self.window completionHandler:^(NSModalResponse 
returnCode) {
 NSAlert *strongAlert = weakAlert;
[strongAlert orderOut:self];
}];

I miss garbage collection.  None of that was necessary.  I still haven't got my 
head around dealing with this under ARC...

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: [BUG] Documents (sandboxed too) won't open from iCloud Drive

2014-11-28 Thread Sean McBride
On Fri, 28 Nov 2014 10:15:14 -0500, Jerry Krinock said:

If I navigate to a text file in my iCloud Drive and File  Open with…
from the contextual menu, it works with TextEdit, Safari, Firefox, iCab
or Opera 12, but fails with my nonsandboxed (I think) BBEdit, or HexEdit.

You can easily tell if an app is sandboxed from Activity Monitor.  Go to the 
CPU tab, and context-click on the table's column header, there you can 
show/hide different columns, including a column that shows if the process is 
sandboxed.

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: help with debugging

2014-11-18 Thread Sean McBride
On Wed, 19 Nov 2014 00:52:13 +0700, sqwarqDev said:

0   CoreFoundation  0x7fff8cd5664c
__exceptionPreprocess + 172
   1   libobjc.A.dylib 0x7fff975c86de
objc_exception_throw + 43
   2   CoreFoundation  0x7fff8cd564fd +
[NSException raise:format:] + 205
   3   AppKit  0x7fff967f3814 -[NSTextView
replaceCharactersInRange:withString:] + 209
   4   YourApp 0x00010f63ccf1 YourApp + 27889
   5   YourApp 0x00010f637a6f YourApp + 6767
   6   AppKit  0x7fff96aad039 
 -[NSIBObjectData 


I know which class this belongs to, and I see the error is generated by
the call at line 3 above. However, in this class there's a huge number
of replaceCharactersInRange: calls. How can I narrow down the search?
Is there any way to use the info above to determine which line of code
is failing? (e.g, what do the numbers after the '+' sign mean and is it
possible to use them to help me find the bug? ).

Those offsets tell you how far into the function (in bytes I think) it was.  
You can indeed bring that back to a line number.  See here:

http://lldb.llvm.org/symbolication.html

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: help with debugging

2014-11-18 Thread Sean McBride
On Tue, 18 Nov 2014 10:25:07 -0800, Jens Alfke said:

 Those offsets tell you how far into the function (in bytes I think) it
was.  You can indeed bring that back to a line number.  See here:
 
 http://lldb.llvm.org/symbolication.html http://lldb.llvm.org/
symbolication.html

That info is for live debugging in lldb

Not exclusively it isn't.

but Phil said these are crash
logs coming from users

No he didn't.  He said in fact that it doesn't crash, but there's a backtrace 
from an uncaught exception in Console logs.

so he's going to need a tool that symbolicates a
log file. I know there are tools for that but I don't know offhand what
they are, since I've never had to do this myself; can anyone fill in the gaps?

It's in the doc I linked to.  Scroll to the lldb.macosx.crashlog part.

I've never tried with an exception backtrace, but there's likely enough info it 
that doc to do it all.

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSPersistentDocument, Export (Save As) and wal/shm

2014-11-17 Thread Sean McBride
On Sat, 15 Nov 2014 14:02:44 -0500, Jerry Krinock said:


 On 2014 Nov 15, at 13:38, Fritz Anderson fri...@manoverboard.org wrote:

 rdar://18994451; I classified it as a data-loss bug, given the near-
certainty of the loss of the journal files.

Indeed it is, Fritz, for the reasons you stated.

Here was my version, Bug 15873041:

http://openradar.appspot.com/radar?id=5268845828767744

Oddly, I think, it has not even been closed as a duplicate.  Its status
is still Open, with no comments from Apple.  It has attached a sample
project, even though it only takes a few minutes to reproduce from an
Apple sample project.

My version is rdar://19001234, which I just created.  My DTS incident came 
back We believe this issue is a bug. Please file a bug report [...] we have 
assigned a replacement incident back to your account.  Seems they did not 
understand I was looking for a workaround, which I have now reiterated.  
Hopefully something will come of it...

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSPersistentDocument, Export (Save As) and wal/shm

2014-11-14 Thread Sean McBride
On Fri, 14 Nov 2014 17:45:13 -0600, Fritz Anderson said:

OS X application, Yosemite (host and target), Xcode 6.1, all-Swift. If
you duplicate (save-as) an existing document, the new document appears
on disk with external journaling files (SHM, WAL).

I just noticed this the other day (in 10.9.5) after switching my app from 10.8 
SDK to 10.9 SDK (for the v2 gatekeeper changes).

Pathetic that it's not fixed in 10.10!

It is impossible to state how undesirable this is without descending
into sarcasm.

I guess it says a lot about the state of NSPersistentDocument. :(

Check out Mike Abdullah's BSManagedDocument if you can.

The solutions I’ve seen from a web search are a year or more old, and
have proven ineffective.

What is the current thinking on this? This is another of those things
that are so conspicuous that I must be missing something obvious.

Jerry Krinock's solutions, that you no doubt found googling, seem to be working 
for me, but I don't like swizzling if I can avoid it.

I actually just opened a DTS incident on this the other day, no word back yet.  
Will follow up here.

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Saving a Document style app

2014-11-07 Thread Sean McBride
On Sat, 18 Oct 2014 11:06:35 -0500, Luther Baker said:

I'd like to save my Document based app in the bundle style format. IE: I'd
like to save things in a directory - like apps like OmniOutliner do.

Out of the box, I get the option to save as sqlite, binary or XML. What I'd
like is to save a 'bundle' with my own extension and nest things like the
the sqlite database inside of it.

Is this type of functionality provided for me by another Cocoa framework or
is this a strictly manual process that has been passed down as convention
from dev to dev?

Is anyone aware of an Apple example app that would demonstrate this? Or any
suggestions regarding an Open Source Cocoa App by anyone here that would be
worth browsing through for this type of stuff?

Indeed Apple recommends using a package for documents, but as you've found, it 
can't easily be done with NS(Persistent)Document.  Please do file a radar for 
this, as the current situation is ridiculous really.

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

  1   2   3   4   5   6   7   8   9   10   >