Re: Getting a dotted font from a regular font

2012-10-01 Thread jonat...@mugginsoft.com


On 1 Oct 2012, at 01:35, Eric Gorr  wrote:

> An odd request I know, but I have a need to take a regular font and obtain a 
> dotted version of it.
> 
> Any clever ideas that would not involve loading the font into a font editor 
> and turing it into a dotted font?
> 

To do this properly you would need to transform the paths associated with each 
glyph within the target font and generate a new NSFont representation.

You can however access the glyph paths for a given character sequence and 
transform that path.

Something like:

Allocate and NSLayoutManager instance and configure the NSTextStorage with your 
text in the target font.
NSLayoutManger handles all the complexity of mapping a character to a 
particular glyph index within a given font.
Then call NSLayoutManager - getGlyphs:range: to retrieve the glyph indexes 

Build a path from glyphs using  the target font.
NSBezierPath - (void)appendBezierPathWithGlyphs:(NSGlyph *)glyphs 
count:(NSInteger)count inFont:(NSFont *)fontObj

Set the dash style
NSBezierPath - (void)setLineDash:(const CGFloat *)pattern 
count:(NSInteger)count phase:(CGFloat)phase

Stroke the path

Regards

Jonathan Mitchell
Mugginsoft LLP


KosmicTask - the Integrated Scripting Environment for OS X.
http://www.mugginsoft.com/KosmicTask



___

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


App won't launch after a crash

2012-10-01 Thread Martin Hewitson
Dear all,

I've received a report from a user saying that, after a crash, the app won't 
launch any more. The crash log looks like below. It looks to me like the app 
bundle has somehow got corrupted, but I've no idea what's going on really. The 
user has tried deleting preferences and app support directory, but it didn't 
help. In the end, I suggested downloading the app again. The user did that, and 
it launches now.

Does anyone have a clue what's happening here?

Cheers,

Martin


0   CoreFoundation  0x7fff83ff9784 
__exceptionPreprocess + 180
1   libobjc.A.dylib 0x7fff88ff2f03 
objc_exception_throw + 45
2   CoreFoundation  0x7fff83ff95a7 
+[NSException raise:format:arguments:] + 103
3   CoreFoundation  0x7fff83ff9534 
+[NSException raise:format:] + 148
4   Foundation  0x7fff853d0075 _decodeInt64 
+ 307
5   AppKit  0x7fff869cf21c -[NSMenuItem 
initWithCoder:] + 1765
6   Foundation  0x7fff853c8d83 
_decodeObjectBinary + 2548
7   Foundation  0x7fff853c9a89 
-[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1229
8   Foundation  0x7fff853c9fc9 
-[NSArray(NSArray) initWithCoder:] + 462
9   Foundation  0x7fff853c8d83 
_decodeObjectBinary + 2548
10  Foundation  0x7fff853c81fd 
_decodeObject + 208
11  AppKit  0x7fff869d3499 -[NSMenu 
initWithCoder:] + 442
12  Foundation  0x7fff853c8d83 
_decodeObjectBinary + 2548
13  Foundation  0x7fff853c81fd 
_decodeObject + 208
14  AppKit  0x7fff869cf2b3 -[NSMenuItem 
initWithCoder:] + 1916
15  Foundation  0x7fff853c8d83 
_decodeObjectBinary + 2548
16  Foundation  0x7fff853c9a89 
-[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1229
17  Foundation  0x7fff853c9fc9 
-[NSArray(NSArray) initWithCoder:] + 462
18  Foundation  0x7fff853c8d83 
_decodeObjectBinary + 2548
19  Foundation  0x7fff853c81fd 
_decodeObject + 208
20  AppKit  0x7fff869d3499 -[NSMenu 
initWithCoder:] + 442
21  Foundation  0x7fff853c8d83 
_decodeObjectBinary + 2548
22  Foundation  0x7fff853c81fd 
_decodeObject + 208
23  AppKit  0x7fff869cf238 -[NSMenuItem 
initWithCoder:] + 1793
24  Foundation  0x7fff853c8d83 
_decodeObjectBinary + 2548
25  Foundation  0x7fff853c81fd 
_decodeObject + 208
26  AppKit  0x7fff869cb1e4 
-[NSNibConnector initWithCoder:] + 406
27  AppKit  0x7fff869cea46 
-[NSNibControlConnector initWithCoder:] + 788
28  Foundation  0x7fff853c8d83 
_decodeObjectBinary + 2548
29  Foundation  0x7fff853c9a89 
-[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1229
30  Foundation  0x7fff853c9fc9 
-[NSArray(NSArray) initWithCoder:] + 462
31  Foundation  0x7fff853c8d83 
_decodeObjectBinary + 2548
32  Foundation  0x7fff853c81fd 
_decodeObject + 208
33  AppKit  0x7fff869ca351 
-[NSIBObjectData initWithCoder:] + 2046
34  Foundation  0x7fff853c8d83 
_decodeObjectBinary + 2548
35  Foundation  0x7fff853c81fd 
_decodeObject + 208
36  AppKit  0x7fff869c9a41 loadNib + 146
37  AppKit  0x7fff869c8fa1 
+[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 248
38  AppKit  0x7fff869c8dd9 
+[NSBundle(NSNibLoading) loadNibNamed:owner:] + 326
39  AppKit  0x7fff869c635b 
NSApplicationMain + 279






smime.p7s
Description: S/MIME cryptographic signature
___

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 won't launch after a crash

2012-10-01 Thread Mike Abdullah
What's the exception? Should appear in the console log somewhere.

On 1 Oct 2012, at 12:17, Martin Hewitson  wrote:

> Dear all,
> 
> I've received a report from a user saying that, after a crash, the app won't 
> launch any more. The crash log looks like below. It looks to me like the app 
> bundle has somehow got corrupted, but I've no idea what's going on really. 
> The user has tried deleting preferences and app support directory, but it 
> didn't help. In the end, I suggested downloading the app again. The user did 
> that, and it launches now.
> 
> Does anyone have a clue what's happening here?
> 
> Cheers,
> 
> Martin
> 
> 
>   0   CoreFoundation  0x7fff83ff9784 
> __exceptionPreprocess + 180
>   1   libobjc.A.dylib 0x7fff88ff2f03 
> objc_exception_throw + 45
>   2   CoreFoundation  0x7fff83ff95a7 
> +[NSException raise:format:arguments:] + 103
>   3   CoreFoundation  0x7fff83ff9534 
> +[NSException raise:format:] + 148
>   4   Foundation  0x7fff853d0075 _decodeInt64 
> + 307
>   5   AppKit  0x7fff869cf21c -[NSMenuItem 
> initWithCoder:] + 1765
>   6   Foundation  0x7fff853c8d83 
> _decodeObjectBinary + 2548
>   7   Foundation  0x7fff853c9a89 
> -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1229
>   8   Foundation  0x7fff853c9fc9 
> -[NSArray(NSArray) initWithCoder:] + 462
>   9   Foundation  0x7fff853c8d83 
> _decodeObjectBinary + 2548
>   10  Foundation  0x7fff853c81fd 
> _decodeObject + 208
>   11  AppKit  0x7fff869d3499 -[NSMenu 
> initWithCoder:] + 442
>   12  Foundation  0x7fff853c8d83 
> _decodeObjectBinary + 2548
>   13  Foundation  0x7fff853c81fd 
> _decodeObject + 208
>   14  AppKit  0x7fff869cf2b3 -[NSMenuItem 
> initWithCoder:] + 1916
>   15  Foundation  0x7fff853c8d83 
> _decodeObjectBinary + 2548
>   16  Foundation  0x7fff853c9a89 
> -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1229
>   17  Foundation  0x7fff853c9fc9 
> -[NSArray(NSArray) initWithCoder:] + 462
>   18  Foundation  0x7fff853c8d83 
> _decodeObjectBinary + 2548
>   19  Foundation  0x7fff853c81fd 
> _decodeObject + 208
>   20  AppKit  0x7fff869d3499 -[NSMenu 
> initWithCoder:] + 442
>   21  Foundation  0x7fff853c8d83 
> _decodeObjectBinary + 2548
>   22  Foundation  0x7fff853c81fd 
> _decodeObject + 208
>   23  AppKit  0x7fff869cf238 -[NSMenuItem 
> initWithCoder:] + 1793
>   24  Foundation  0x7fff853c8d83 
> _decodeObjectBinary + 2548
>   25  Foundation  0x7fff853c81fd 
> _decodeObject + 208
>   26  AppKit  0x7fff869cb1e4 
> -[NSNibConnector initWithCoder:] + 406
>   27  AppKit  0x7fff869cea46 
> -[NSNibControlConnector initWithCoder:] + 788
>   28  Foundation  0x7fff853c8d83 
> _decodeObjectBinary + 2548
>   29  Foundation  0x7fff853c9a89 
> -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1229
>   30  Foundation  0x7fff853c9fc9 
> -[NSArray(NSArray) initWithCoder:] + 462
>   31  Foundation  0x7fff853c8d83 
> _decodeObjectBinary + 2548
>   32  Foundation  0x7fff853c81fd 
> _decodeObject + 208
>   33  AppKit  0x7fff869ca351 
> -[NSIBObjectData initWithCoder:] + 2046
>   34  Foundation  0x7fff853c8d83 
> _decodeObjectBinary + 2548
>   35  Foundation  0x7fff853c81fd 
> _decodeObject + 208
>   36  AppKit  0x7fff869c9a41 loadNib + 146
>   37  AppKit  0x7fff869c8fa1 
> +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 248
>   38  AppKit  0x7fff869c8dd9 
> +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 326
>   39  AppKit  0x7fff869c635b 
> NSApplicationMain + 279
> 
> 
> 
> 
> ___
> 
> 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)list

Re: App won't launch after a crash

2012-10-01 Thread Martin Hewitson
Oops, sorry, I chopped off the top of the report. Here it is:

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x, 0x
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Application Specific Information:
abort() called
*** Terminating app due to uncaught exception 
'NSInvalidUnarchiveOperationException', reason: '*** -[NSKeyedUnarchiver 
decodeInt64ForKey:]: value for key (NSTag) is not an integer number'




On Oct 1, 2012, at 07:41 AM, Mike Abdullah  wrote:

> What's the exception? Should appear in the console log somewhere.
> 
> On 1 Oct 2012, at 12:17, Martin Hewitson  wrote:
> 
>> Dear all,
>> 
>> I've received a report from a user saying that, after a crash, the app won't 
>> launch any more. The crash log looks like below. It looks to me like the app 
>> bundle has somehow got corrupted, but I've no idea what's going on really. 
>> The user has tried deleting preferences and app support directory, but it 
>> didn't help. In the end, I suggested downloading the app again. The user did 
>> that, and it launches now.
>> 
>> Does anyone have a clue what's happening here?
>> 
>> Cheers,
>> 
>> Martin
>> 
>> 
>>  0   CoreFoundation  0x7fff83ff9784 
>> __exceptionPreprocess + 180
>>  1   libobjc.A.dylib 0x7fff88ff2f03 
>> objc_exception_throw + 45
>>  2   CoreFoundation  0x7fff83ff95a7 
>> +[NSException raise:format:arguments:] + 103
>>  3   CoreFoundation  0x7fff83ff9534 
>> +[NSException raise:format:] + 148
>>  4   Foundation  0x7fff853d0075 _decodeInt64 
>> + 307
>>  5   AppKit  0x7fff869cf21c -[NSMenuItem 
>> initWithCoder:] + 1765
>>  6   Foundation  0x7fff853c8d83 
>> _decodeObjectBinary + 2548
>>  7   Foundation  0x7fff853c9a89 
>> -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1229
>>  8   Foundation  0x7fff853c9fc9 
>> -[NSArray(NSArray) initWithCoder:] + 462
>>  9   Foundation  0x7fff853c8d83 
>> _decodeObjectBinary + 2548
>>  10  Foundation  0x7fff853c81fd 
>> _decodeObject + 208
>>  11  AppKit  0x7fff869d3499 -[NSMenu 
>> initWithCoder:] + 442
>>  12  Foundation  0x7fff853c8d83 
>> _decodeObjectBinary + 2548
>>  13  Foundation  0x7fff853c81fd 
>> _decodeObject + 208
>>  14  AppKit  0x7fff869cf2b3 -[NSMenuItem 
>> initWithCoder:] + 1916
>>  15  Foundation  0x7fff853c8d83 
>> _decodeObjectBinary + 2548
>>  16  Foundation  0x7fff853c9a89 
>> -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1229
>>  17  Foundation  0x7fff853c9fc9 
>> -[NSArray(NSArray) initWithCoder:] + 462
>>  18  Foundation  0x7fff853c8d83 
>> _decodeObjectBinary + 2548
>>  19  Foundation  0x7fff853c81fd 
>> _decodeObject + 208
>>  20  AppKit  0x7fff869d3499 -[NSMenu 
>> initWithCoder:] + 442
>>  21  Foundation  0x7fff853c8d83 
>> _decodeObjectBinary + 2548
>>  22  Foundation  0x7fff853c81fd 
>> _decodeObject + 208
>>  23  AppKit  0x7fff869cf238 -[NSMenuItem 
>> initWithCoder:] + 1793
>>  24  Foundation  0x7fff853c8d83 
>> _decodeObjectBinary + 2548
>>  25  Foundation  0x7fff853c81fd 
>> _decodeObject + 208
>>  26  AppKit  0x7fff869cb1e4 
>> -[NSNibConnector initWithCoder:] + 406
>>  27  AppKit  0x7fff869cea46 
>> -[NSNibControlConnector initWithCoder:] + 788
>>  28  Foundation  0x7fff853c8d83 
>> _decodeObjectBinary + 2548
>>  29  Foundation  0x7fff853c9a89 
>> -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1229
>>  30  Foundation  0x7fff853c9fc9 
>> -[NSArray(NSArray) initWithCoder:] + 462
>>  31  Foundation  0x7fff853c8d83 
>> _decodeObjectBinary + 2548
>>  32  Foundation  0x7fff853c81fd 
>> _decodeObject + 208
>>  33  AppKit  0x7fff869ca351 
>> -[NSIBObjectData initWithCoder:] + 2046
>>  34  Foundation  0x7fff853c8d83 
>> _decodeObjectBinary + 2548
>>  35  Foundation  0x7fff853c81fd 
>> _decodeObject + 208
>>  36  AppKit  0x7fff869c9a41 loadNib + 146
>>  37  AppKit   

Re: NSTextField not updated during large process

2012-10-01 Thread Koen van der Drift
On Sun, Sep 30, 2012 at 7:20 PM, Koen van der Drift
 wrote:
>
> On Sep 30, 2012, at 6:51 PM, Ken Thomases  wrote:
>
>> Move the long-running operation to a background thread (e.g. using 
>> -performSelectorInBackground:withObject:, or dispatch_async() to a non-main 
>> queue, or NSOperation and NSOperationQueue, etc.).  However, all updates to 
>> the GUI still have to happen on the main thread.  Therefore, all updates of 
>> properties to which the GUI is bound have to happen on the main thread.  You 
>> can shunt those over using -performSelectorOnMainThread:..., 
>> dispatch_[a]sync to the main queue, NSOperation and +[NSOperationQueue 
>> mainQueue], etc.
>
> Thanks, I'll try that.

Ok, I decided to use NSOperation(Queue) as it is generally recommended
over performSelectorXXX to be a more modern API, and have been reading
a bit about it.  In Hillegass' Cocoa book, he uses processQueue
addOperationWithBlock, in other examples on the webs, people make
subclasses of NSOperation to put their tasks in. What's the difference
between these two appraches (if any)?

Thanks,

- Koen.

___

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 won't launch after a crash

2012-10-01 Thread Mike Abdullah

On 1 Oct 2012, at 13:13, Martin Hewitson  wrote:

> Oops, sorry, I chopped off the top of the report. Here it is:
> 
> Exception Type:  EXC_CRASH (SIGABRT)
> Exception Codes: 0x, 0x
> Crashed Thread:  0  Dispatch queue: com.apple.main-thread
> 
> Application Specific Information:
> abort() called
> *** Terminating app due to uncaught exception 
> 'NSInvalidUnarchiveOperationException', reason: '*** -[NSKeyedUnarchiver 
> decodeInt64ForKey:]: value for key (NSTag) is not an integer number'

Well this seems like your nib is corrupted in some fashion. I wouldn't expect 
the preferences or app support to make a scrap of difference here. Try asking 
your customer to re-install to see if they're got a corrupted copy of the app.

If not, go through your main menu xib carefully and look for any objects that 
somehow have a non-integer tag perhaps.


___

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: The joy of unexpected SIGABRTs

2012-10-01 Thread Alex Zavatone

On Sep 29, 2012, at 4:58 PM, Jens Alfke wrote:

> 
> On Sep 28, 2012, at 9:00 PM, Alex Zavatone  wrote:
> 
>> I just spent 10 mins wiring up the GUI, did nothing else, and now when one 
>> scene appears, Xcode instantly SIGABRTs, without any information in the 
>> console or the debugger that comes close to telling why this happened.
> 
> Well, what _did_ it show?

All it showed was how the SIGABRT was brought to the screen.  Not what 
triggered the SIGABRT


>> Trapping for -[NSObject(NSObject) doesNotRecognizeSelector:] doesn't help.
> 
> That’s only going to catch one specific cause of exceptions. Didn't you set 
> an all-exceptions breakpoint as I’ve suggested a few dozen times?

Considering it was sometime in the AM, I did not have the ability to recall 
your tips.  Unfortunately, I have not had the spare time to even try your 
suggestion out, but it's on the list of things that have to be done.  Too many 
nights in the office 'til midnight, 4 and now 5 AM.

It's on the list.

But I have to mention that it's these magical unexpected moments when Objective 
C or Xcode says "I don't know what to do, so I'll just crash and leave you no 
useful info, unless you know that special secret" that can be rather maddening. 
 I lost count of how many times (aside from this) that Xcode "Unexpectedly 
Quit" or "would you like to continue or crash" Friday night/Saturday morning.

Hopefully this week when we update to 4.5, much of that pain will go away.  
Fingers and other digits crossed.

Thanks again Jens, it's on the list.

___

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 won't launch after a crash

2012-10-01 Thread Martin Hewitson

On Oct 1, 2012, at 10:20 AM, Mike Abdullah  wrote:

> 
> On 1 Oct 2012, at 13:13, Martin Hewitson  wrote:
> 
>> Oops, sorry, I chopped off the top of the report. Here it is:
>> 
>> Exception Type:  EXC_CRASH (SIGABRT)
>> Exception Codes: 0x, 0x
>> Crashed Thread:  0  Dispatch queue: com.apple.main-thread
>> 
>> Application Specific Information:
>> abort() called
>> *** Terminating app due to uncaught exception 
>> 'NSInvalidUnarchiveOperationException', reason: '*** -[NSKeyedUnarchiver 
>> decodeInt64ForKey:]: value for key (NSTag) is not an integer number'
> 
> Well this seems like your nib is corrupted in some fashion. I wouldn't expect 
> the preferences or app support to make a scrap of difference here. Try asking 
> your customer to re-install to see if they're got a corrupted copy of the app.

The app was working, then stopped working. Then they downloaded it again, and 
it worked again. Most strange.

> 
> If not, go through your main menu xib carefully and look for any objects that 
> somehow have a non-integer tag perhaps.
> 


I can check, but as I say, it was working fine. It just stopped being able to 
launch after a crash. Is there a way that the XIB files can get corrupted when 
the app crashes?

Thanks for your thoughts on this.

Martin


Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer 
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: martin.hewit...@aei.mpg.de
WWW: http://www.aei.mpg.de/~hewitson








smime.p7s
Description: S/MIME cryptographic signature
___

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


Did 10.7.5 break App Sandbox for anyone?

2012-10-01 Thread Sean McBride
Hi all,

Since it's so half-baked, I only play with App Sandbox once in a while, but it 
seems 10.7.5 has a major regression.

When built with com.apple.security.app-protection=true my app launches on 
10.7.4 and 10.8.x, but crashes at launch on 10.7.5:

Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0001, 0x

Application Specific Information:
dyld: launch, running initializers
/usr/lib/libSystem.B.dylib
xpchelper reply message validation: code signature invalid
The code signature is not valid: The operation couldn’t be completed. (OSStatus 
error -67061.)

Application Specific Signatures:
code signature invalid

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libxpc.dylib0x7fff91ff6267 runtime_init + 823
1   libdispatch.dylib   0x7fff953ea3f2 dispatch_once_f + 53
2   libxpc.dylib0x7fff91ff6af5 
_xpc_runtime_set_domain + 285
3   libxpc.dylib0x7fff91ff3f3d _libxpc_initializer 
+ 452
4   libSystem.B.dylib   0x00010baf9e7e 
libSystem_initializer + 222
5   dyld0x7fff607f3da6 
ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) + 218
6   dyld0x7fff607f3af2 
ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) + 46
7   dyld0x7fff607f12e4 
ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned 
int, ImageLoader::InitializerTimingList&) + 260
8   dyld0x7fff607f127d 
ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned 
int, ImageLoader::InitializerTimingList&) + 157
9   dyld0x7fff607f127d 
ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned 
int, ImageLoader::InitializerTimingList&) + 157
10  dyld0x7fff607f20b7 
ImageLoader::runInitializers(ImageLoader::LinkContext const&, 
ImageLoader::InitializerTimingList&) + 59
11  dyld0x7fff607e74dd 
dyld::initializeMainExecutable() + 206
12  dyld0x7fff607eb60b 
dyld::_main(macho_header const*, unsigned long, int, char const**, char 
const**, char const**) + 1852
13  dyld0x7fff607e5059 _dyld_start + 49

Anyone else seeing 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: Compiling GC apps under OS X 10.8

2012-10-01 Thread Sean McBride
On Mon, 1 Oct 2012 10:52:26 +1000, Shane Stanley said:

>I have a GC app with a deployment version of 10.6. If I compile it in
>4.5 under OS X 10.8, using either 10.8 or 10.7 SDK, and run the
>resulting app in OS X 10.6, I gets lots of this sort of error:
>
>objc[201]: GC: 0x10029cf20 + 24 isn't in the auto_zone, break on
>objc_assign_ivar_error to debug.
>objc[201]: GC: 0x10029cf20 + 8 isn't in the auto_zone, break on
>objc_assign_ivar_error to debug.
>objc[201]: GC: 0x10029cf20 + 64 isn't in the auto_zone, break on
>objc_assign_ivar_error to debug.
>objc[201]: GC: 0x10029cf20 + 72 isn't in the auto_zone, break on
>objc_assign_ivar_error to debug.
>objc[201]: GC: 0x100290670 + 48 isn't in the auto_zone, break on
>objc_assign_ivar_error to debug.
>objc[201]: GC: 0x103592630 + 48 isn't in the auto_zone, break on
>objc_assign_ivar_error to debug.
>
>It also occurs under 10.7, although less often and less predictably.

I believe I've seen them too (though am in 10.7 right now).  I just brushed 
them off as harmless warnings... do you think they are more than that?

>Or should I just give up on compiling GC stuff under Xcode versions
>later than 4.3.3, and therefore 10.8?

Clearly moving to ARC is in order... but it's no small task to just totally 
change an applications's memory model out from underneath 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: App won't launch after a crash

2012-10-01 Thread Jens Alfke

On Oct 1, 2012, at 9:11 AM, Martin Hewitson  wrote:

> I can check, but as I say, it was working fine. It just stopped being able to 
> launch after a crash. Is there a way that the XIB files can get corrupted 
> when the app crashes?

No. Files in the app bundle are never opened with write access. Typically users 
won’t even have permission to modify files in the app bundle (if the app is in 
/Applications.)

I hate to sound alarmist, but my first guess would be filesystem corruption. 
Ask the customer to run Disk Utility and verify the volume.

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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: Did 10.7.5 break App Sandbox for anyone?

2012-10-01 Thread Kyle Sluder
On Mon, Oct 1, 2012, at 09:38 AM, Sean McBride wrote:
> Hi all,
> 
> Since it's so half-baked, I only play with App Sandbox once in a while,
> but it seems 10.7.5 has a major regression.
> 
> When built with com.apple.security.app-protection=true my app launches on
> 10.7.4 and 10.8.x, but crashes at launch on 10.7.5:
>  
> Anyone else seeing this?

Yes, a lot of people:

https://devforums.apple.com/message/732771

--Kyle Sluder
___

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: The joy of unexpected SIGABRTs

2012-10-01 Thread Alex Zavatone

On Sep 29, 2012, at 4:58 PM, Jens Alfke wrote:

> 
> On Sep 28, 2012, at 9:00 PM, Alex Zavatone  wrote:
> 
>> I just spent 10 mins wiring up the GUI, did nothing else, and now when one 
>> scene appears, Xcode instantly SIGABRTs, without any information in the 
>> console or the debugger that comes close to telling why this happened.
> 
> Well, what _did_ it show?
> 
>> Trapping for -[NSObject(NSObject) doesNotRecognizeSelector:] doesn't help.
> 
> That’s only going to catch one specific cause of exceptions. Didn't you set 
> an all-exceptions breakpoint as I’ve suggested a few dozen times?
> 
> —Jens

For those who also haven't had the time.  Here are the references I have for 
this:

http://blog.manbolo.com/2012/01/23/xcode-tips-1-break-on-exceptions
http://alwaysthecritic.typepad.com/atc/2009/06/iphone-app-debugging-stop-on-exception.html
http://stackoverflow.com/questions/4961770/run-stop-on-objective-c-exception-in-xcode-4

Thanks Jens.  Fingers crossed to see if it produces any useful information on 
those unhelpful storyboard crashes.


___

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: Did 10.7.5 break App Sandbox for anyone?

2012-10-01 Thread Sean McBride
On Mon, 1 Oct 2012 10:37:40 -0700, Kyle Sluder said:

>> Anyone else seeing this?
>
>Yes, a lot of people:
>
>https://devforums.apple.com/message/732771

That seems paywalled. :(  Which I guess explains why googling found nothing...

Anyway, at least I'm not alone.  I'll let it sort itself out and try Sandbox 
next year...

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: Did 10.7.5 break App Sandbox for anyone?

2012-10-01 Thread Kyle Sluder
On Mon, Oct 1, 2012, at 10:46 AM, Sean McBride wrote:
> On Mon, 1 Oct 2012 10:37:40 -0700, Kyle Sluder said:
> 
> >> Anyone else seeing this?
> >
> >Yes, a lot of people:
> >
> >https://devforums.apple.com/message/732771
> 
> That seems paywalled. :(  Which I guess explains why googling found
> nothing...
> 
> Anyway, at least I'm not alone.  I'll let it sort itself out and try
> Sandbox next year...

Are you not a registered member of the Mac Developer program?

--Kyle Sluder
___

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: Did 10.7.5 break App Sandbox for anyone?

2012-10-01 Thread Sean McBride
On Mon, 1 Oct 2012 11:05:21 -0700, Kyle Sluder said:

>> >> Anyone else seeing this?
>> >
>> >Yes, a lot of people:
>> >
>> >https://devforums.apple.com/message/732771
>> 
>> That seems paywalled. :(  Which I guess explains why googling found
>> nothing...
>> 
>> Anyway, at least I'm not alone.  I'll let it sort itself out and try
>> Sandbox next year...
>
>Are you not a registered member of the Mac Developer program?

I am, but the google search bot is apparently not. :)

The UI is so horrible for those forums that I never bother with them (except 
for NDA discussions, where there's no choice.)

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 won't launch after a crash

2012-10-01 Thread Ken Thomases
On Oct 1, 2012, at 11:11 AM, Martin Hewitson wrote:

> Is there a way that the XIB files can get corrupted when the app crashes?

An app can do anything that the kernel permits it to.  A crash is, pretty much 
by definition, a sign that the app is going wild.  It's confused.  It's doing 
stuff it wasn't intended to do.  It may be sending arbitrary messages to 
arbitrary objects or the like.  It may be executing data as though it were code.

All of that said, it would be fairly surprising if the app had the NIB already 
open for writing, making it fairly unlikely that it would modify it.  And if 
the user account doesn't have write permission to the app bundle, then the 
kernel won't allow it, no matter what an out-of-control app might try to do.

Regards,
Ken


___

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: The joy of unexpected SIGABRTs

2012-10-01 Thread Alex Zavatone
Hmm.  At least, in Xcode 4.2, I can confirm that adding a "break on all 
exceptions" either on throw on on catch does nothing to provide any informative 
information on just what is causing the exception to happen.

Console output:

Catchpoint 3 (catch)Pending breakpoint 1 - "__cxa_begin_catch" resolved
Pending breakpoint 2 - ""MainScreen.m":48" resolved
Current language:  auto; currently objective-c
Catchpoint 5 (throw)(gdb) 

It's just stopped in Main, in the return statement below:
return UIApplicationMain(argc, argv, nil, 
NSStringFromClass([AppDelegate class]));

Thread 1: Stopped at breakpoint 1. 

I don't know if you can get anything useful from that output, but I sure can't.

However, after testing on under Xcode 4.5, at least lldb outputs more useful 
information in the console compared to gdb in 4.2. 

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: 
'[ setValue:forUndefinedKey:]: this class is not key 
value coding-compliant for the key BlackButton.'

Looks like the upgrade to Mountain Lion is my next step.  Thanks man.  Much 
more useful.



On Oct 1, 2012, at 1:38 PM, Alex Zavatone wrote:

> 
> On Sep 29, 2012, at 4:58 PM, Jens Alfke wrote:
> 
>> 
>> On Sep 28, 2012, at 9:00 PM, Alex Zavatone  wrote:
>> 
>>> I just spent 10 mins wiring up the GUI, did nothing else, and now when one 
>>> scene appears, Xcode instantly SIGABRTs, without any information in the 
>>> console or the debugger that comes close to telling why this happened.
>> 
>> Well, what _did_ it show?
>> 
>>> Trapping for -[NSObject(NSObject) doesNotRecognizeSelector:] doesn't help.
>> 
>> That’s only going to catch one specific cause of exceptions. Didn't you set 
>> an all-exceptions breakpoint as I’ve suggested a few dozen times?
>> 
>> —Jens
> 
> For those who also haven't had the time.  Here are the references I have for 
> this:
> 
> http://blog.manbolo.com/2012/01/23/xcode-tips-1-break-on-exceptions
> http://alwaysthecritic.typepad.com/atc/2009/06/iphone-app-debugging-stop-on-exception.html
> http://stackoverflow.com/questions/4961770/run-stop-on-objective-c-exception-in-xcode-4
> 
> Thanks Jens.  Fingers crossed to see if it produces any useful information on 
> those unhelpful storyboard crashes.
> 
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

___

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 won't launch after a crash

2012-10-01 Thread Kyle Sluder
On Mon, Oct 1, 2012, at 07:20 AM, Mike Abdullah wrote:
> 
> On 1 Oct 2012, at 13:13, Martin Hewitson 
> wrote:
> 
> > Oops, sorry, I chopped off the top of the report. Here it is:
> > 
> > Exception Type:  EXC_CRASH (SIGABRT)
> > Exception Codes: 0x, 0x
> > Crashed Thread:  0  Dispatch queue: com.apple.main-thread
> > 
> > Application Specific Information:
> > abort() called
> > *** Terminating app due to uncaught exception 
> > 'NSInvalidUnarchiveOperationException', reason: '*** -[NSKeyedUnarchiver 
> > decodeInt64ForKey:]: value for key (NSTag) is not an integer number'
> 
> Well this seems like your nib is corrupted in some fashion. I wouldn't
> expect the preferences or app support to make a scrap of difference here.
> Try asking your customer to re-install to see if they're got a corrupted
> copy of the app.

Are you sure? It could also be the restorable state that's corrupted.

Martin, have your user hold the Shift key when launching your app. This
will bypass state restoration, with the caveat that your app will not
restore any unsaved untitled documents that were open at the time of the
crash.

--Kyle Sluder
___

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 when loading NSViewController view with NSArrayController [solved]

2012-10-01 Thread Lee Ann Rucker

On Sep 30, 2012, at 11:38 AM, Kyle Sluder wrote:

> On Sun, Sep 30, 2012, at 10:57 AM, Lee Ann Rucker wrote:
>> Weird that you didn't get the warning, but we've switched to the pattern
>> of
>> 
>> [self addObserver:self forKeyPath:@"ctrl.selectedObjects.someString"...
>> 
>> and that's saved countless headaches. You can remove your own observers
>> in dealloc so you never need to worry about when to remove the observer.
> 
> Self-observation has always been a code smell to me. I suppose it's a
> lot better now that we have -removeObserver:forKeyPath:context:.
> 
> In general, it is not a good idea to rely on -dealloc for cleanup of
> anything other than object references (that is, sending -release to
> strong ivars). Any other resource that requires explicit management
> (NSNotificationCenter registration, KVO, file handles, etc.) should not
> be managed in -dealloc unless that resource is *explicitly* tied to the
> lifetime of the object (a reuse pool, logging).
> 

> I'd add and remove my observation in -setCtrl:. Or, since this is a view
> controller, perhaps add an explicit teardown method
> (-removeViewFromWindow or -windowIsClosing or something) and remove my
> observation there.
> 


We've tried that. Either way you have to do cleanup somewhere; dealloc isn't 
the best place, but not all objects have nice convenient teardown hooks like 
windows and views do. Doing this in a setter means custom setters all over the 
place, so no nice @synthesize, and fun when a subclass needs to add a different 
set of observation values. Plus you'll have to call a setter in dealloc or 
duplicate the removeObserver code, neither of which are optimal.



___

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


FS item in trash

2012-10-01 Thread tridiak
Is there an API (carbon or cocoa) to determine if an item is in the trash?
NSFileManager, NSFileHandle and carbon Files.h do not have anything.

Or do I just do a path search looking for ".trash"?

TIA Mark

___

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: The joy of unexpected SIGABRTs

2012-10-01 Thread Jens Alfke

On Oct 1, 2012, at 11:59 AM, Alex Zavatone  wrote:

> It's just stopped in Main, in the return statement below:
>   return UIApplicationMain(argc, argv, nil, 
> NSStringFromClass([AppDelegate class]));
> 
> Thread 1: Stopped at breakpoint 1. 
> 
> I don't know if you can get anything useful from that output, but I sure 
> can't.

Are you seeing the entire stack in the debugger UI? Drag the slider at the 
bottom of the pane all the way to the right.

If that doesn’t help, type “bt” at the debugger prompt and copy the backtrace 
into a reply so we can see it.

—Jens
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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 won't launch after a crash

2012-10-01 Thread Martin Hewitson

On Oct 1, 2012, at 03:08 PM, Kyle Sluder  wrote:

> On Mon, Oct 1, 2012, at 07:20 AM, Mike Abdullah wrote:
>> 
>> On 1 Oct 2012, at 13:13, Martin Hewitson 
>> wrote:
>> 
>>> Oops, sorry, I chopped off the top of the report. Here it is:
>>> 
>>> Exception Type:  EXC_CRASH (SIGABRT)
>>> Exception Codes: 0x, 0x
>>> Crashed Thread:  0  Dispatch queue: com.apple.main-thread
>>> 
>>> Application Specific Information:
>>> abort() called
>>> *** Terminating app due to uncaught exception 
>>> 'NSInvalidUnarchiveOperationException', reason: '*** -[NSKeyedUnarchiver 
>>> decodeInt64ForKey:]: value for key (NSTag) is not an integer number'
>> 
>> Well this seems like your nib is corrupted in some fashion. I wouldn't
>> expect the preferences or app support to make a scrap of difference here.
>> Try asking your customer to re-install to see if they're got a corrupted
>> copy of the app.
> 
> Are you sure? It could also be the restorable state that's corrupted.
> 
> Martin, have your user hold the Shift key when launching your app. This
> will bypass state restoration, with the caveat that your app will not
> restore any unsaved untitled documents that were open at the time of the
> crash.

I'll have them do that, though just replacing the app with a fresh download 
worked. Good to know about this shift-key trick in any case.

Martin






smime.p7s
Description: S/MIME cryptographic signature
___

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: FS item in trash

2012-10-01 Thread Ken Thomases
On Oct 1, 2012, at 2:49 PM, tridiak wrote:

> Is there an API (carbon or cocoa) to determine if an item is in the trash?
> NSFileManager, NSFileHandle and carbon Files.h do not have anything.

err = FSDetermineIfRefIsEnclosedByFolder (kOnAppropriateDisk, kTrashFolderType, 
&ref, &result);

(That's an example directly out of the Leopard-era Folder Manager Reference 
docs.)

Cheers,
Ken


___

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: The joy of unexpected SIGABRTs

2012-10-01 Thread Alex Zavatone
Well, that makes a huge amount of difference showing what has been called under 
4.2.



Sent from my iPad

On Oct 1, 2012, at 3:50 PM, Jens Alfke  wrote:

> 
> On Oct 1, 2012, at 11:59 AM, Alex Zavatone  wrote:
> 
>> It's just stopped in Main, in the return statement below:
>>  return UIApplicationMain(argc, argv, nil, 
>> NSStringFromClass([AppDelegate class]));
>> 
>> Thread 1: Stopped at breakpoint 1. 
>> 
>> I don't know if you can get anything useful from that output, but I sure 
>> can't.
> 
> Are you seeing the entire stack in the debugger UI? Drag the slider at the 
> bottom of the pane all the way to the right.
> 
> If that doesn’t help, type “bt” at the debugger prompt and copy the backtrace 
> into a reply so we can see it.
> 
> —Jens
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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 not updated during large process

2012-10-01 Thread Koen van der Drift

On Oct 1, 2012, at 8:59 AM, Koen van der Drift  
wrote:

> Ok, I decided to use NSOperation(Queue) as it is generally recommended
> over performSelectorXXX to be a more modern API, and have been reading
> a bit about it.  In Hillegass' Cocoa book, he uses processQueue
> addOperationWithBlock, in other examples on the webs, people make
> subclasses of NSOperation to put their tasks in. What's the difference
> between these two appraches (if any)?

Playing around with NSOperationQueue, and I implemented it as follows. I use 
this method to do some calculations, and store the results in a table.

- (void)doMyTask 
{
[self cleanUp];  // clear the NSTableView

NSOperationQueue*myQueue = [[NSOperationQueue alloc] init];

[myQueue addOperationWithBlock:^(void)
{
[self parseData];   // calculate the new data and update the model
}];

 // now tell everyone we're done
[self finishedTask];// update the NSTableView and the UI
}

This works, and is faster than before, but if I run this several times in a 
row, at one point I get a crash, somewhere in the parseData routine.  It could 
happen after ten times, or even after one time. But always at the same point:

[self willChangeValueForKey:@"myArray"];
[self.myArray addObject: newObject];
[self didChangeValueForKey:@"myArray"];

This is called during the parse, when I update the myArray property as a result 
of the parsing.

Any idea what could be going on?

- Koen.


___

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: FS item in trash

2012-10-01 Thread Charles Srstka
On Oct 1, 2012, at 3:29 PM, Ken Thomases  wrote:

> On Oct 1, 2012, at 2:49 PM, tridiak wrote:
> 
>> Is there an API (carbon or cocoa) to determine if an item is in the trash?
>> NSFileManager, NSFileHandle and carbon Files.h do not have anything.
> 
> err = FSDetermineIfRefIsEnclosedByFolder (kOnAppropriateDisk, 
> kTrashFolderType, &ref, &result);
> 
> (That's an example directly out of the Leopard-era Folder Manager Reference 
> docs.)

Note that this API is deprecated in Mountain Lion.

Charles

___

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 not updated during large process

2012-10-01 Thread Koen van der Drift

On Oct 1, 2012, at 5:39 PM, Koen van der Drift  
wrote:

>[myQueue addOperationWithBlock:^(void)
>{
>[self parseData];  // calculate the new data and update the model
>   }];
> 
> // now tell everyone we're done
>[self finishedTask];   // update the NSTableView and the UI


More confusion...
 
So, [self parseData] creates a new array which is shown in a table (bound to 
the resulting NSArray), but also needs to update another view. The table gets 
updated, but the other view not. As it turns out, once [self finishedTask] gets 
called, the array is still empty. I guess because the parsing is still going on 
in another thread. 

I solved it as follows by adding another operation on the mainQueue inside the 
first queue:

- (void)doMyTask 
{
   [self cleanUp]; 

   NSOperationQueue*myQueue = [[NSOperationQueue alloc] init];

   [myQueue addOperationWithBlock:^(void)
   {
   [self parseData];// calculate the new data and update the model

[[NSOperationQueue mainQueue] addOperationWithBlock:^(void)
{
 [self finishedTask];   // update the NSTableView and 
the UI
}];
   }];
}

Is that a correct approach?


- Koen.
___

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 not updated during large process

2012-10-01 Thread Mike Abdullah

On 1 Oct 2012, at 22:39, Koen van der Drift  wrote:

> 
> On Oct 1, 2012, at 8:59 AM, Koen van der Drift  
> wrote:
> 
>> Ok, I decided to use NSOperation(Queue) as it is generally recommended
>> over performSelectorXXX to be a more modern API, and have been reading
>> a bit about it.  In Hillegass' Cocoa book, he uses processQueue
>> addOperationWithBlock, in other examples on the webs, people make
>> subclasses of NSOperation to put their tasks in. What's the difference
>> between these two appraches (if any)?
> 
> Playing around with NSOperationQueue, and I implemented it as follows. I use 
> this method to do some calculations, and store the results in a table.
> 
> - (void)doMyTask 
> {
>[self cleanUp];  // clear the NSTableView
> 
>NSOperationQueue*myQueue = [[NSOperationQueue alloc] init];
>   
>[myQueue addOperationWithBlock:^(void)
>{
>[self parseData];  // calculate the new data and update the model
>   }];
> 
> // now tell everyone we're done
>[self finishedTask];   // update the NSTableView and the UI
> }
> 
> This works, and is faster than before, but if I run this several times in a 
> row, at one point I get a crash, somewhere in the parseData routine.  It 
> could happen after ten times, or even after one time. But always at the same 
> point:
> 
>[self willChangeValueForKey:@"myArray"];
>[self.myArray addObject: newObject];
>[self didChangeValueForKey:@"myArray"];
> 
> This is called during the parse, when I update the myArray property as a 
> result of the parsing.
> 
> Any idea what could be going on?

Yes, you don't understand the consequences of your code yet. AppKit is not 
threadsafe. You absolutely MUST only update UI on the main thread for something 
like this.

Make sure your -parseData routine is threadsafe, and then bounce back over to 
the main thread for -finishedTask.


___

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 not updated during large process

2012-10-01 Thread Koen van der Drift

On Oct 1, 2012, at 6:31 PM, Mike Abdullah  wrote:

> Yes, you don't understand the consequences of your code yet. AppKit is not 
> threadsafe. You absolutely MUST only update UI on the main thread for 
> something like this.
> 
> Make sure your -parseData routine is threadsafe, and then bounce back over to 
> the main thread for -finishedTask.

Oh I think I see now what I did wrong. Since I update the array *during* the 
parse, the tableview already gets updated as well since it is bound to the 
array. So I either need to update the array on the main thread, or wait with 
updating it until after parseData is done. I'll try what works best.

- Koen.
___

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: FS item in trash

2012-10-01 Thread tridiak

On 2/10/2012, at 10:44 AM, Charles Srstka wrote:

> On Oct 1, 2012, at 3:29 PM, Ken Thomases  wrote:
> 
>> On Oct 1, 2012, at 2:49 PM, tridiak wrote:
>> 
>>> Is there an API (carbon or cocoa) to determine if an item is in the trash?
>>> NSFileManager, NSFileHandle and carbon Files.h do not have anything.
>> 
>> err = FSDetermineIfRefIsEnclosedByFolder (kOnAppropriateDisk, 
>> kTrashFolderType, &ref, &result);
>> 
>> (That's an example directly out of the Leopard-era Folder Manager Reference 
>> docs.)
> 
> Note that this API is deprecated in Mountain Lion.
> 
> Charles
> 

Ok. Thanks
___

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: Compiling GC apps under OS X 10.8

2012-10-01 Thread Shane Stanley
On 02/10/2012, at 2:48 AM, Sean McBride  wrote:

>> I have a GC app with a deployment version of 10.6. If I compile it in
>> 4.5 under OS X 10.8, using either 10.8 or 10.7 SDK, and run the
>> resulting app in OS X 10.6, I gets lots of this sort of error:
>> 
>> objc[201]: GC: 0x10029cf20 + 24 isn't in the auto_zone, break on
>> objc_assign_ivar_error to debug.
>> objc[201]: GC: 0x10029cf20 + 8 isn't in the auto_zone, break on
>> objc_assign_ivar_error to debug.
>> objc[201]: GC: 0x10029cf20 + 64 isn't in the auto_zone, break on
>> objc_assign_ivar_error to debug.
>> objc[201]: GC: 0x10029cf20 + 72 isn't in the auto_zone, break on
>> objc_assign_ivar_error to debug.
>> objc[201]: GC: 0x100290670 + 48 isn't in the auto_zone, break on
>> objc_assign_ivar_error to debug.
>> objc[201]: GC: 0x103592630 + 48 isn't in the auto_zone, break on
>> objc_assign_ivar_error to debug.
>> 
>> It also occurs under 10.7, although less often and less predictably.
> 
> I believe I've seen them too (though am in 10.7 right now).  I just brushed 
> them off as harmless warnings... do you think they are more than that?

I had been assuming they are, given that they often coincide with other 
glitches and crashes. I've run very simple apps that generate them repeatedly, 
and they seem to crash after a while -- but I might well be mis-attributing the 
cause. And in some cases they coincide with glitches (eg, text entered in a 
table cell disappearing on tab/enter). The only reference I can find in 
searching is a similar message accompanying crashes in Growl.

(I am getting other crashes, too. Showing a save or open panel, or using 
threaded animation with a progress bar, generates the [NSImage 
_allocAuxiliaryStorage] + 158 / -[NSImage copyWithZone:] + 66 crash others have 
reported here, and also disappears in 32-bit mode.)

> 
>> Or should I just give up on compiling GC stuff under Xcode versions
>> later than 4.3.3, and therefore 10.8?
> 
> Clearly moving to ARC is in order... but it's no small task to just totally 
> change an applications's memory model out from underneath it... :(

I wish. Unfortunately the changes in 10.8 mean any app that uses ARC and 
AppleScriptObjC is effectively a 10.8-only app. Not the solution to backwards 
compatibility I'm after.

-- 
Shane Stanley 
'AppleScriptObjC Explored' 


___

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: FS item in trash

2012-10-01 Thread gweston

Is there an API (carbon or cocoa) to determine if an item is in the trash?
NSFileManager, NSFileHandle and carbon Files.h do not have anything.

Or do I just do a path search looking for ".trash"?

You definitely do *not* do that. The name and location of the trash directory is an 
implementation detail that you shouldn't and needn't rely on. It's not ".trash" 
regardless. To date, the location of the trash on the volume containing the user's home 
directory is ~/.Trash and the location on all other volumes that have a trash at all is 
/Volumes/mount_point/.Trashes/`id -u` but that could change without notice.

In recent OS versions, you can use NSFileManager to get the URLs for mounted 
volumes and then loop over them using:

NSURL* u = [fm URLForDirectory:NSTrashDirectory 
inDomain:NSUserDomainMask appropriateForURL:mountPointURL create:YES 
error:&error];

Note that if you pass NO for the create argument and the trash directory 
doesn't exist you'll get back nil which may or may not be useful for your needs.

___

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

ArrayController cannot sort

2012-10-01 Thread Gerriet M. Denkmann
I have a TableView and an ArrayController (no DataSource) and everything works 
fine.
Clicking on a column header sorts my table ascending or descending.

But the order of the rows is totally wrong.
It seems that the ArrayController uses compare: to sort my strings.

The documentation rightly says: "If you are comparing strings to present to the 
end-user, you should typically uselocalizedCompare:".

So: how do I instruct my ArrayController to use localizedCompare: ?

Gerriet.

___

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: ArrayController cannot sort

2012-10-01 Thread Kyle Sluder
On Mon, Oct 1, 2012, at 07:56 PM, Gerriet M. Denkmann wrote:
> So: how do I instruct my ArrayController to use localizedCompare: ?


-[NSTableColumn setSortDescriptorPrototype:]



--Kyle Sluder
___

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: ArrayController cannot sort

2012-10-01 Thread Ken Thomases
On Oct 1, 2012, at 10:20 PM, Kyle Sluder wrote:

> On Mon, Oct 1, 2012, at 07:56 PM, Gerriet M. Denkmann wrote:
>> So: how do I instruct my ArrayController to use localizedCompare: ?
> 
> -[NSTableColumn setSortDescriptorPrototype:]
> 
> 

You can also set this up in the Attributes inspector for the table column in IB.

Cheers,
Ken


___

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: ArrayController cannot sort

2012-10-01 Thread Gerriet M. Denkmann

On 2 Oct 2012, at 11:10, Ken Thomases  wrote:

> On Oct 1, 2012, at 10:20 PM, Kyle Sluder wrote:
> 
>> On Mon, Oct 1, 2012, at 07:56 PM, Gerriet M. Denkmann wrote:
>>> So: how do I instruct my ArrayController to use localizedCompare: ?
>> 
>> -[NSTableColumn setSortDescriptorPrototype:]
>> 
>> 
> 
> You can also set this up in the Attributes inspector for the table column in 
> IB.

Thanks a lot. Now my tables are much easier to read.

Kind regards,

Gerriet.



___

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