Re: What changed in 10.10 scrollView / scrollPoint?

2014-11-19 Thread Gideon King
In case anyone else comes across this:

I finally managed to track down the trigger for this issue. I have some sibling 
views, one which is along the top of my window. In some circumstances when I 
switch into full screen mode, I set the height of this view to zero and 
expanded the other main view to fill the screen.

If I change the size of the document view in my scroll view (the main view 
which I have now expanded to fill the screen), and then use scrollPoint, it 
must trigger some sort of caching operation for the window. At that point, it 
chokes on the zero height view at the top of the window. Don’t ask me why - as 
far as I can tell this does not happen if the zero height view is at the bottom 
or on either side with zero width.

Setting the height of the view to 1 did not fix the issue, but setting it to 2 
did.

It was choking on argb32_image_mark or related methods, so all I can assume is 
that something about the configuration made it unable to create an image (there 
used to be a similar issue apparently in iOS up to 7.1.2.

I have now managed to work around the problem, but this is clearly new behavior 
in 10.10, seems totally bizarre, and is not triggered by swipe scrolling or 
pinch zooming.

Thanks again for the suggestions of places to look.

Gideon


> On 18 Nov 2014, at 7:53 am, Graham Cox  wrote:
> 
> ...
> 
> 
>> On 18 Nov 2014, at 12:58 am, Gideon King  wrote:
>> 
>> I have always done this using scrollPoint on my view. I have been using this 
>> since 10.6. My view is not layer backed and has a single subview which is a 
>> layer *hosting* view.
>> 
>> Now in Yosemite 10.10, this takes a *very* long time at 100% CPU, with a 
>> stack trace looking something like this:
>> 
>> CoreGraphics`argb32_sample_argb32 + 621
>> CoreGraphics`argb32_image_mark + 1696
>> CoreGraphics`RGBA32_image + 1156
> 


___

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

What changed in 10.10 scrollView / scrollPoint?

2014-11-17 Thread Gideon King
Hi, I have an app where I need to programmatically scroll the content of a full 
screen scroll view.

I have always done this using scrollPoint on my view. I have been using this 
since 10.6. My view is not layer backed and has a single subview which is a 
layer *hosting* view.

Now in Yosemite 10.10, this takes a *very* long time at 100% CPU, with a stack 
trace looking something like this:

CoreGraphics`argb32_sample_argb32 + 621
CoreGraphics`argb32_image_mark + 1696
CoreGraphics`RGBA32_image + 1156
libRIP.A.dylib`ripl_Mark + 23
libRIP.A.dylib`RIPLayerBltImage + 1146
libRIP.A.dylib`ripc_RenderImage + 265
libRIP.A.dylib`ripc_EndLayer + 1204
CoreGraphics`CGContextEndTransparencyLayer + 53
QuartzCore`-[CALayer renderInContext:] + 1025
QuartzCore`-[CALayer _renderSublayersInContext:] + 479
QuartzCore`-[CALayer renderInContext:] + 1082
AppKit`-[NSView 
_layerBackedDisplayRectIgnoringOpacity:inContext:isRootView:flipContextIfNeedeed:]
 + 245
AppKit`-[NSView(NSInternal) _drawLayerInContext:] + 252
AppKit`-[NSView(NSInternal) 
_recursive:displayRectIgnoringOpacity:inGraphicsContext:CGContext:topView:shouldChangeFontReferenceColor:]
 + 1121
AppKit`-[NSView(NSInternal) 
_recursive:displayRectIgnoringOpacity:inGraphicsContext:CGContext:topView:shouldChangeFontReferenceColor:]
 + 2135
AppKit`-[NSView(NSInternal) 
_recursive:displayRectIgnoringOpacity:inContext:topView:] + 117
AppKit`-[NSView _drawRectBasedDisplayRectIgnoringOpacity:inContext:] + 214
AppKit`-[NSView displayRectIgnoringOpacity:inContext:] + 529
AppKit`-[_NSMirrorDocumentView drawRect:] + 370
AppKit`-[NSView(NSInternal) 
_recursive:displayRectIgnoringOpacity:inGraphicsContext:CGContext:topView:shouldChangeFontReferenceColor:]
 + 1186
AppKit`__46-[NSView(NSLayerKitGlue) drawLayer:inContext:]_block_invoke + 218
AppKit`-[NSView(NSLayerKitGlue) 
_drawViewBackingLayer:inContext:drawingHandler:] + 2407
AppKit`-[NSView(NSLayerKitGlue) drawLayer:inContext:] + 108
AppKit`-[_NSBackingLayerContents drawLayer:inContext:] + 145
QuartzCore`-[CALayer drawInContext:] + 119
AppKit`-[_NSTiledLayer drawTile:inContext:] + 625
AppKit`-[_NSTiledLayerContents drawLayer:inContext:] + 169
QuartzCore`-[CALayer drawInContext:] + 119
AppKit`-[NSTileLayer drawInContext:] + 169
QuartzCore`CABackingStoreUpdate_ + 3306
QuartzCore`___ZN2CA5Layer8display_Ev_block_invoke + 59
QuartzCore`x_blame_allocations + 81
QuartzCore`CA::Layer::display_() + 1546
AppKit`-[NSTileLayer display] + 119
AppKit`-[_NSTiledLayerContents update:] + 5688
AppKit`-[_NSTiledLayer display] + 375
QuartzCore`CA::Layer::display_if_needed(CA::Transaction*) + 603
QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 35
QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 242
QuartzCore`CA::Transaction::commit() + 390
AppKit`-[NSClipView _immediateScrollToPoint:] + 8642
AppKit`-[NSClipView scrollToPoint:] + 241
AppKit`-[NSScrollView scrollClipView:toPoint:] + 75
AppKit`-[NSClipView _scrollTo:animateScroll:flashScrollerKnobs:] + 1682
AppKit`-[NSClipView _scrollPoint:fromView:] + 86
AppKit`-[NSView scrollPoint:] + 38
NovaMind`-[NMSCanvasView scrollPoint:](self=0x00010f011a90, 
_cmd=0x7fff920309d8, aPoint=NSPoint at 0x7fff5fbfbe60) + 320 at 
NMSCanvasView.m:607

I have checked my view, my superview (the clipview), and the scrollview and 
none of them have layers, so I don’t know what is being drawn.

Also once this operation is complete, it seems to update again, outside the 
call to scrollPoint like this:

CoreGraphics`argb32_image_mark + 1866
CoreGraphics`RGBA32_image + 1156
libRIP.A.dylib`ripl_Mark + 23
libRIP.A.dylib`RIPLayerBltImage + 1146
libRIP.A.dylib`ripc_RenderImage + 265
libRIP.A.dylib`ripc_EndLayer + 1204
CoreGraphics`CGContextEndTransparencyLayer + 53
QuartzCore`-[CALayer renderInContext:] + 1025
QuartzCore`-[CALayer _renderSublayersInContext:] + 479
QuartzCore`-[CALayer renderInContext:] + 1082
AppKit`-[NSView 
_layerBackedDisplayRectIgnoringOpacity:inContext:isRootView:flipContextIfNeedeed:]
 + 245
AppKit`-[NSView(NSInternal) _drawLayerInContext:] + 252
AppKit`-[NSView(NSInternal) 
_recursive:displayRectIgnoringOpacity:inGraphicsContext:CGContext:topView:shouldChangeFontReferenceColor:]
 + 1121
AppKit`-[NSView(NSInternal) 
_recursive:displayRectIgnoringOpacity:inGraphicsContext:CGContext:topView:shouldChangeFontReferenceColor:]
 + 2135
AppKit`-[NSView(NSInternal) 
_recursive:displayRectIgnoringOpacity:inContext:topView:] + 117
AppKit`-[NSView _drawRectBasedDisplayRectIgnoringOpacity:inContext:] + 214
AppKit`-[NSView displayRectIgnoringOpacity:inContext:] + 529
AppKit`-[_NSMirrorDocumentView drawRect:] + 370
AppKit`-[NSView(NSInternal) 
_recursive:displayRectIgnoringOpacity:inGraphicsContext:CGContext:topView:shouldChangeFontReferenceColor:]
 + 1186
AppKit`__46-[NSView(NSLayerKitGlue) drawLayer:inContext:]_block_invoke + 218
AppKit`-[NSView(NSLayerKitGlue) 
_drawViewBackingLayer:inContext:drawingHandler:] + 2407
AppKit`-[NSView(NSLayerKitGlue) drawLayer:inContext:] + 10

Finding events

2014-01-26 Thread Gideon King
When users save a document, I want to save a reference to an event in the file. 
Then when they open the document on either the same machine or another one, I 
want them to have access to the same event.

There appear to be three things that could be saved:
- eventIdentifier
- calendarItemIdentifier
- calendarItemExternalIdentifier

The documentation says that the eventIdentifier can change if an event is 
edited and a different calendar chosen, so it seems pretty easy to lose track 
on that one, even though the documentation does also seem to imply that this is 
a suitable way to find events.

The documentation implies that the calendarItemIdentifier is more stable, but 
not 100% reliable, and would be different for the same event on a different 
machine with synced calendars.

The calendarItemExternalIdentifier seems to mostly provide what you need to 
find an item if it is on a shared calendar. They do list some reasons that may 
fail too, and also say that the identifier is different between Mac and iOS.

So would the following be a suitable approach to do my best to find an event:
- When saving the event reference, save all three identifiers in the file
- When loading:
  1. try to find the event by event identifier
  2. if that fails, try to find the event by calendar item identifier
  3. if that fails, try to find the event by the calendar item external 
identifier
  4. If the event if found by any of these means, save the latest data just in 
case one of the other identifiers has changed.

If this is not the right approach, what do I need to do differently?

When the documentation says that external identifiers are different between Mac 
and iOS, does that mean that there is no way of referencing the same event on a 
shared calendar that is accessed from both operating systems?

It seems that reminders don’t have the extra level of a reminder identifier 
like the event identifier - I really don’t understand why you would need both 
for an event and only one for a reminder. So for reminders, I would assume that 
just steps 2 and 3 above would suffice.

Any tips on this would be much appreciated. I have seen posts where others have 
asked similar questions, but have not found anything approaching a definitive 
answer.

Regards

Gideon






___

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 7 downloadable fonts

2014-01-21 Thread Gideon King
Cool, thanks for that. I thought there must be a step I was missing.

I don’t have the 7.1 beta to test and see if there is a bug there - will try to 
find time do grab it...

Regards

Gideon

On 21 Jan 2014, at 5:33 pm, Tualatrix Chou  wrote:

> After downloading the font, if you want to use it offline (or do not
> call the download API again),  you can try to save the font URL and
> next time of launching, use "CTFontManagerRegisterFontsForURL" to
> register the font.
> 
> This file is what you want:
> https://github.com/fdstevex/FDSFontDownloader/blob/master/FDSFontDownloader.m
> 
> I try to use this on my app, everything works file on simulator, but
> register failed on device on iOS 7.1 Beta. Not sure if it is an bug of
> iOS 7.1.
> 
> The article worth to read:
> http://blog.stevex.net/2013/09/downloadable-fonts-in-ios-7/
> 


___

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

iOS 7 downloadable fonts

2014-01-18 Thread Gideon King
Hi, I am trying to use CTFontDescriptorMatchFontDescriptorsWithProgressHandler 
to download a font. It appears to download fine, and I can display it in my 
application. [UIFont familyNames] includes that font.

I restart my application, and [UIFont familyNames] does not include the 
downloaded font, and I can’t create the font using fontWithName:size:.

I have tested this on both my iPad and the simulator, and it always forgets the 
downloaded font on restart of the application.

On the simulator, if I go to Library/Assets/com_apple_MobileAsset_Font I can 
see the folder with the downloaded font in it, and there is a 
com_apple_MobileAsset_Font.plist file which includes all the information about 
the downloaded font. So it knows about the font, and the font is really there, 
but when I try to use it in my application it isn’t there until I download it 
again during that session.

Is there something I am doing wrong? Do I need to initialize something to get 
it to include the downloaded fonts in the search?


Regards

Gideon






___

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: System fonts on iOS 7

2014-01-18 Thread Gideon King
Ah, interesting to know that, thanks Jens.

Yes, I guess I could leave it unchecked. But also my files are used 
cross-platform, so I would prefer to store font information for standard fonts, 
so will probably do the translation to standard fonts during pasting anyway.

Regards

Gideon


> Fonts with names prefixed with a "." or "%" are hidden from the higher-level 
> APIs for listing fonts. It's been that way since the dawn of time (i.e. since 
> the original Mac in 1984.) I'm not sure why iOS 7 has a separate hidden copy 
> of Helvetica Neue that's used for the UI, though.

> 
> If you want to look up these fonts, you'll probably need to drop down to the 
> CoreText API. But in general, I think it's fine to just not check any font 
> name in your UI in this situation. 
> 
> —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

System fonts on iOS 7

2014-01-18 Thread Gideon King
I am trying to display font information on the user interface of my 
application, and have come across some hidden fonts that are obviously there in 
the system, but not listed in the UIFont familyNames. This can happen when the 
user has pasted rich text into my application and it is in a hidden system font.

And I know at least some of where this comes from - for example, when I use 
UIFont systemFontOfSize:, the font name is ".HelveticaNeueInterface-M3” and the 
family name is ".Helvetica Neue Interface”.

When I use [UIFont familyNames] there is nothing named ".Helvetica Neue 
Interface”, although there is "Helvetica Neue”. My conclusion is that this is 
somehow a hidden font.

I have a list of all the fonts as returned by UIFont, and want to put a 
checkmark beside the font the user is using in the text. But of course, the 
hidden system fonts are not in the list, so what am I supposed to do to 
indicate as the selected font? 

We have the seemingly impossible situation where the text is drawn in a font 
face that is not in the list returned by [UIFont familyNames].

By looking at the UIFont preferredFontForTextStyle: return values, I can see 
that there are at least the following hidden fonts:
".HelveticaNeueInterface-M3”
".HelveticaNeueInterface-MediumP4”
".HelveticaNeueInterface-Bold”

I wondered about using the font descriptors to turn it into a font that 
actually exists as far as the user is concerned, but asking for the font’s font 
descriptor for ".HelveticaNeueInterface-M3” and then asking for matching font 
descriptors only gave me a font name of ".AppleSystemUIFont”, and of course if 
I pass that into fontWithName, it returns the ".HelveticaNeueInterface-M3”, so 
that just took me in a circle back to where I started.

I’m thinking that when someone pastes text into my application, I could perhaps 
have a check in my code that the font is in the list returned by UIFont, and if 
not, I could probably have a lookup for the known system hidden fonts and 
replace them with suitable visible alternatives, and for anything unknown, I 
could have a fallback to a known font.

It all seems a bit messy, so any feedback would be welcome.

Thanks

Gideon


___

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 do I debug weak_unregister_no_lock?

2014-01-15 Thread Gideon King
That makes sense. This particular inspector is fairly simple, but it does use 
one other Omni component on it: some OUIColorComponentSlider objects. If the 
crash that Omni have seen was also with inspectors using that class, then that 
would point towards that doing something wrong.

I’m kind of tempted to just take this to Omni guys rather than take everyone’s 
time, but I think there may be something here of general applicability if 
something comes out of this on either how to track this kind of memory issue 
down when it does happen, or lessons on how to prevent it...

Regards

Gideon

On 15 Jan 2014, at 6:23 pm, Ken Thomases  wrote:

> On Jan 15, 2014, at 1:56 AM, Kyle Sluder wrote:
> 
>> On Jan 14, 2014, at 9:05 PM, Quincey Morris 
>>  wrote:
>>> 
>>> Second, I’ve noticed some very surprising behavior with weak references at 
>>> dealloc time. If an object being deallocated has a weak reference to 
>>> another object, and it was the only reference so that the other object is 
>>> also due to be deallocated […]
> 
> That doesn't make sense.  A weak reference can't be the only reference to an 
> object.  As I'm sure you know, objects are deallocated (and weak references 
> nil'd) when the last *strong* reference is broken.
> 
> Whatever the mysterious behavior is, I don't think it can be that.
> 
> I suppose it could be that the object has a weak reference to itself and that 
> could cause some sort of problem if a message were sent through that weak 
> reference during -dealloc.  I would expect that having a weak reference to 
> self would be fairly common and that ARC would have to cope properly.
> 
> Since the original crash was an access violation inside the runtime, I would 
> suspect a memory smashing bug prior to the destruction of the 
> OUIInspectorPane subclass instance.  When ARC goes to unregister that 
> instance's weak reference, it steps on a land mine that was laid previously.  
> Since the crash seems not to happen at random, I guess the memory smashing 
> was done shortly before this.  (It's certainly possible for a corrupted data 
> structure to not influence anything until a long time after the corruption 
> has happened, but in that situation the crash is more likely to affect random 
> other code.)  So, I'd suspect the -dealloc of the OUIInspectorPane subclass, 
> prior to the implicit call of super's -dealloc.  Or the code which does the 
> final release of that object which provokes the deallocation.
> 
> 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: How do I debug weak_unregister_no_lock?

2014-01-15 Thread Gideon King
OK, I have a single pane inspector which chains to another single pane 
inspector using pushPane. For this one particular pane, sometimes when we pop 
back to the parent, it gave the error.

I tried putting a dealloc in my class and nilling out everything, but still got 
the problem. I then added 
self.inspector = nil;
self.parentSlice = nil;
to my dealloc, and since then I have not been able to reproduce the problem at 
all.

I have created a number of subclasses of OUISingleViewInspectorPane but it is 
only this particular one that triggers the problem.

I don’t know if you want to create a dealloc method for OUIInspectorPane which 
nils those two references… It would obviously be better to know the cause and 
fix it, but in the absence of that, perhaps this will fix the issue for 
everyone.


Regards

Gideon


On 15 Jan 2014, at 5:56 pm, Kyle Sluder  wrote:

> On Jan 14, 2014, at 9:05 PM, Quincey Morris 
>  wrote:
>> 
>>> On Jan 14, 2014, at 18:34 , Gideon King  wrote:
>>> 
>>> Although it is always happening at the same point in the code, I really 
>>> have no idea where to look for debugging it.
>> 
>> I have no answers, but a couple of observations.
>> 
>> First, you seem to be crashing in the dealloc (or destructor, if it’s a C++ 
>> class) of class OUIInspectorPane. I’d suggest you focus on properties of 
>> that class whose value is a weak object reference.
> 
> Gah. We tried _so hard_ to find this bug before shipping our iOS 7 apps. We 
> still have no idea what causes it, but it always seems to happen in the 
> ARC-generated autodestructor of an OUIInspectorPane.
> 
> Can you describe the contents of your inspectors? For a while we had a hunch 
> it involved some OmniOutliner-specific piece of UI.


___

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 do I debug weak_unregister_no_lock?

2014-01-14 Thread Gideon King
I just had this problem come up again. 

It happens when I pop a view controller, so there are a whole bunch of things 
being tidied up behind the scenes. 

Although it is always happening at the same point in the code, I really have no 
idea where to look for debugging it. 

Any tips on debugging this would be very much appreciated.

Thanks

Gideon





On 12 Jan 2014, at 11:54 am, Gideon King  wrote:

> I have seen this crash twice in running my code over 100 times, so it’s 
> pretty hard to reproduce, but definitely there. 
> 
> It seems to be related to deallocating an OUIInspectorPane object, but when I 
> look in the debugger, it is actually my subclass of that object. I have 
> zombies turned on, but that didn’t seem to isolate the problem. 
> 
> Can anyone suggest a way of tracking this down? 
> 
> * thread #1: tid = 0x9b3267, 0x026c492b 
> libobjc.A.dylib`weak_unregister_no_lock + 119, queue = 
> 'com.apple.main-thread, stop reason = EXC_BAD_ACCESS (code=1, 
> address=0x2936f6d0)
>frame #0: 0x026c492b libobjc.A.dylib`weak_unregister_no_lock + 119
>frame #1: 0x026c50fa libobjc.A.dylib`objc_destroyWeak_slow(objc_object**) 
> + 135
>frame #2: 0x002db8f1 NovaMind`-[OUIInspectorPane 
> .cxx_destruct](self=0x168effd0, _cmd=0x026ca62e) + 113 at 
> OUIInspectorPane.m:21
>frame #3: 0x026b32d4 
> libobjc.A.dylib`object_cxxDestructFromClass(objc_object*, objc_class*) + 128
>frame #4: 0x026b324f libobjc.A.dylib`object_cxxDestruct + 20
>frame #5: 0x026be22c libobjc.A.dylib`objc_destructInstance + 48
>frame #6: 0x02dfdecc CoreFoundation`-[NSObject(NSObject) __dealloc_zombie] 
> + 156
>frame #7: 0x01327c56 UIKit`-[UIViewController dealloc] + 1818
>frame #8: 0x00361747 NovaMind`-[OUIViewController 
> dealloc](self=0x168effd0, _cmd=0x026ca678) + 167 at OUIViewController.m:69
>frame #9: 0x01324975 UIKit`-[UIViewController release] + 89
>frame #10: 0x026c4e97 libobjc.A.dylib`objc_release + 71
>frame #11: 0x0120a5fc UIKit`__destroy_helper_block_121 + 124
>frame #12: 0x04c557a5 libsystem_sim_blocks.dylib`_Block_release + 207
>frame #13: 0x01277e3f UIKit`-[UIViewAnimationBlockDelegate dealloc] + 66
>frame #14: 0x026c5692 libobjc.A.dylib`objc_object::sidetable_release(bool) 
> + 268
>frame #15: 0x026c6adf libobjc.A.dylib`-[NSObject release] + 25
>frame #16: 0x02ce1cb0 CoreFoundation`CFRelease + 272
>frame #17: 0x02de974e CoreFoundation`-[__NSDictionaryI dealloc] + 126
>frame #18: 0x026c5692 libobjc.A.dylib`objc_object::sidetable_release(bool) 
> + 268
>frame #19: 0x026c4e81 libobjc.A.dylib`objc_release + 49
>frame #20: 0x026c5ce7 libobjc.A.dylib`(anonymous 
> namespace)::AutoreleasePoolPage::pop(void*) + 537
>frame #21: 0x02d01968 CoreFoundation`_CFAutoreleasePoolPop + 24
>frame #22: 0x02d066c3 CoreFoundation`__CFRunLoopRun + 1971
>frame #23: 0x02d05ac3 CoreFoundation`CFRunLoopRunSpecific + 467
>frame #24: 0x02d058db CoreFoundation`CFRunLoopRunInMode + 123
>frame #25: 0x040529e2 GraphicsServices`GSEventRunModal + 192
>frame #26: 0x04052809 GraphicsServices`GSEventRun + 104
>frame #27: 0x01215d3b UIKit`UIApplicationMain + 1225
>frame #28: 0x216d NovaMind`main(argc=1, argv=0xbfffec78) + 141 at 
> main.m:16
> 
> Thanks
> 
> Gideon
> 


___

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: UIPopoverController and UIToolbar interactions

2014-01-13 Thread Gideon King
…or set your passthroughViews to nil *after* your presentPopover call and have 
it just dismiss the popover as normal when you tap something on the toolbar.

Regards

Gideon

On 14 Jan 2014, at 8:28 am, Sixten Otto  wrote:

> I tend to agree that it's problematic, but it is deliberate. From the
> documentation:
> 
> 
…



___

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 do I debug weak_unregister_no_lock?

2014-01-11 Thread Gideon King
I have seen this crash twice in running my code over 100 times, so it’s pretty 
hard to reproduce, but definitely there. 

It seems to be related to deallocating an OUIInspectorPane object, but when I 
look in the debugger, it is actually my subclass of that object. I have zombies 
turned on, but that didn’t seem to isolate the problem. 

Can anyone suggest a way of tracking this down? 

* thread #1: tid = 0x9b3267, 0x026c492b libobjc.A.dylib`weak_unregister_no_lock 
+ 119, queue = 'com.apple.main-thread, stop reason = EXC_BAD_ACCESS (code=1, 
address=0x2936f6d0)
frame #0: 0x026c492b libobjc.A.dylib`weak_unregister_no_lock + 119
frame #1: 0x026c50fa libobjc.A.dylib`objc_destroyWeak_slow(objc_object**) + 
135
frame #2: 0x002db8f1 NovaMind`-[OUIInspectorPane 
.cxx_destruct](self=0x168effd0, _cmd=0x026ca62e) + 113 at OUIInspectorPane.m:21
frame #3: 0x026b32d4 
libobjc.A.dylib`object_cxxDestructFromClass(objc_object*, objc_class*) + 128
frame #4: 0x026b324f libobjc.A.dylib`object_cxxDestruct + 20
frame #5: 0x026be22c libobjc.A.dylib`objc_destructInstance + 48
frame #6: 0x02dfdecc CoreFoundation`-[NSObject(NSObject) __dealloc_zombie] 
+ 156
frame #7: 0x01327c56 UIKit`-[UIViewController dealloc] + 1818
frame #8: 0x00361747 NovaMind`-[OUIViewController dealloc](self=0x168effd0, 
_cmd=0x026ca678) + 167 at OUIViewController.m:69
frame #9: 0x01324975 UIKit`-[UIViewController release] + 89
frame #10: 0x026c4e97 libobjc.A.dylib`objc_release + 71
frame #11: 0x0120a5fc UIKit`__destroy_helper_block_121 + 124
frame #12: 0x04c557a5 libsystem_sim_blocks.dylib`_Block_release + 207
frame #13: 0x01277e3f UIKit`-[UIViewAnimationBlockDelegate dealloc] + 66
frame #14: 0x026c5692 libobjc.A.dylib`objc_object::sidetable_release(bool) 
+ 268
frame #15: 0x026c6adf libobjc.A.dylib`-[NSObject release] + 25
frame #16: 0x02ce1cb0 CoreFoundation`CFRelease + 272
frame #17: 0x02de974e CoreFoundation`-[__NSDictionaryI dealloc] + 126
frame #18: 0x026c5692 libobjc.A.dylib`objc_object::sidetable_release(bool) 
+ 268
frame #19: 0x026c4e81 libobjc.A.dylib`objc_release + 49
frame #20: 0x026c5ce7 libobjc.A.dylib`(anonymous 
namespace)::AutoreleasePoolPage::pop(void*) + 537
frame #21: 0x02d01968 CoreFoundation`_CFAutoreleasePoolPop + 24
frame #22: 0x02d066c3 CoreFoundation`__CFRunLoopRun + 1971
frame #23: 0x02d05ac3 CoreFoundation`CFRunLoopRunSpecific + 467
frame #24: 0x02d058db CoreFoundation`CFRunLoopRunInMode + 123
frame #25: 0x040529e2 GraphicsServices`GSEventRunModal + 192
frame #26: 0x04052809 GraphicsServices`GSEventRun + 104
frame #27: 0x01215d3b UIKit`UIApplicationMain + 1225
frame #28: 0x216d NovaMind`main(argc=1, argv=0xbfffec78) + 141 at 
main.m:16

Thanks

Gideon









___

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

dataWithPDFInsideRect: subview positions when using layer backed views

2013-11-16 Thread Gideon King
Here’s the scenario: All views are flipped. OSX 10.9.

I have a view with frame and bounds 0,0,2000,2000.
The first subview has a frame 0,0,2000,2000 and bounds -1000,-1000,2000,2000. I 
set it to draw a solid color. On screen it covers the first view. 
It has a number of small 100,50 subviews at different locations.

All this draws fine on screen, whether I am using layer backing or not. If I do 
not use layer backing, it also renders properly using dataWithPDFInsideRect:.

As soon as I start using layer backing, dataWithPDFInsideRect: gives the 
following result:
- the first level subview draws as if its origin was the same as its superview 
- i.e. it only covers the top left quadrant of the superview,
- all the second level subviews draw on top of each other at origin 0,0.

Is this a known issue? Is there a workaround (apart from not using layers)?


Thanks

Gideon



___

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: Helping Arc with: "PerformSelector may cause a leak because its selector is unknown"

2013-10-21 Thread Gideon King
You can tell it to ignore the warning like this:

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
NSNumber *status = [ self performSelector: aSelector  withObject: a  
withObject: b ];
#pragma clang diagnostic pop

Hope that helps.

Gideon

On 22/10/2013, at 4:37 PM, "Gerriet M. Denkmann"  wrote:

> 
> Xcode 5.0 complains: "PerformSelector may cause a leak because its selector 
> is unknown"
> 
> Is there a way to tell the compiler that "aSelector" returns an object which 
> does NOT need to get released by the caller ? 
> I saw something like "__autoreleasing", but don't know how to apply this in 
> my case.
> 
> 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: Converting views to use layer backing

2013-10-17 Thread Gideon King
I knew I was going to want to do something like that myself so created a small 
test project.

You need to have the scrollview, the clipview, and the document view all layer 
backed for it to work with the scrollview magnification. You shouldn't need to 
explicitly set the autoresizesSubviews on. It should all scale just like a non 
layer-backed view, scaling the subviews with it. All that works fine if you 
don't change the bounds origin.

The subviews are positioned relative to the bounds origin, so changing the 
bounds origin positions the subviews in the place you want…but it does break 
the drawing of the view itself. 

I haven't found a way to draw a layer backed view which has its bounds origin 
shifted yet. I thought using a CGContextTranslateCTM in the drawing code would 
work, but got nowhere with that.

If I set the bounds origin to be 10,10 then my view tiles would get drawn with 
a 10px gap between them, and the drawing would start at 10,10. If I set the 
bounds origin to -10,-10, then the view tiles would be drawn with a 10px gap 
between them and the drawing would start at -10,-10 which means that there is a 
20px gap along the top and left of the view. Clearly layer backed views don't 
like to have their bounds origins shifted.

I guess the problems stem from the way the drawing code draws the content into 
the layer, but am not certain how to fix it. 

Can anyone else help with how to draw a layer backed view where the bounds 
origin has been shifted?

Regards

Gideon


___

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

EventKit calendarItemIdentifier and calendarItemExternalIdentifier

2013-07-15 Thread Gideon King
I am converting some code from CalendarStore to EventKit, and see that there 
are now two identifiers.

It looks as if it I want to enable access to events across multiple devices, I 
should always store the calendarItemExternalIdentifier - correct? It is not 
clear from the documentation whether this is always going to be set, even if 
the calendar is not shared.

Also my users will already have event IDs recorded from the old uid property. 
Is this guaranteed to be the same as the calendarItemIdentifier in EventKit?

The documentation says that there could be more than one item matching the 
external identifier. So should my code treat them all as if they are the 
event/reminder I want to update, and update all occurrences? What about 
inconsistencies? Or should I store both the identifier and external identifier, 
and use the one with the identifier as the master? (assuming I can find it)

The documentation also says that the external identifier will be different if 
you are accessing the same thing on iOS vs OSX, which would seem to suggest 
that some sort of combination of identifiers would be sensible.

Any direction on this would be much appreciated. 


Thanks

Gideon








___

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

realizeClass crash

2013-07-12 Thread Gideon King
Hi, my application is crashing consistently for one user. The application is in 
use successfully by thousands of people, and this user has it installed on 3 
machines but it only crashes on one of them.

Any ideas what would cause this kind of crash?

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

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

Application Specific Information:
objc[423]: layout bitmap too short

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib 0x7fff93813d4d _objc_trap() + 0
1   libobjc.A.dylib 0x7fff93813e8e _objc_fatal + 195
2   libobjc.A.dylib 0x7fff93814cfd 
set_bits(layout_bitmap, unsigned long, unsigned long) + 83
3   libobjc.A.dylib 0x7fff9380859d layout_bitmap_create 
+ 277
4   libobjc.A.dylib 0x7fff93816a67 
realizeClass(class_t*) + 1460
5   libobjc.A.dylib 0x7fff9381754d realizeAllClasses() 
+ 81
6   libobjc.A.dylib 0x7fff93818ca6 objc_getClassList + 
67
7   com.omnigroup.framework.OmniBase0x0001007954b7 +[OBPostLoader 
processSelector:initialize:] + 215
8   com.omnigroup.framework.OmniBase0x000100795394 +[OBPostLoader 
processClasses] + 36
9   com.omnigroup.framework.OmniBase0x00010079522c +[OBObject 
initialize] + 76
10  libobjc.A.dylib 0x7fff9380b236 _class_initialize + 
310
11  libobjc.A.dylib 0x7fff9380b138 _class_initialize + 
56
12  libobjc.A.dylib 0x7fff9380b138 _class_initialize + 
56
13  libobjc.A.dylib 0x7fff9380b0f3 
prepareForMethodLookup + 164
14  libobjc.A.dylib 0x7fff9380aeef lookUpMethod + 71
15  libobjc.A.dylib 0x7fff938092fc objc_msgSend + 188
16  com.novamind.NovaMind5  0x00010025cd6a 
+[OAPreferenceController(NM) load] + 95
17  libobjc.A.dylib 0x7fff93808d90 call_load_methods + 
389
18  libobjc.A.dylib 0x7fff9380898f load_images + 130
19  dyld0x7fff66e58e02 
dyld::notifySingle(dyld_image_states, ImageLoader const*) + 230
20  dyld0x7fff66e67057 
ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned 
int, ImageLoader::InitializerTimingList&) + 357
21  dyld0x7fff66e66eba 
ImageLoader::runInitializers(ImageLoader::LinkContext const&, 
ImageLoader::InitializerTimingList&) + 54
22  dyld0x7fff66e58fc0 
dyld::initializeMainExecutable() + 207
23  dyld0x7fff66e5cb04 
dyld::_main(macho_header const*, unsigned long, int, char const**, char 
const**, char const**, unsigned long*) + 3060
24  dyld0x7fff66e58397 
dyldbootstrap::start(macho_header const*, int, char const**, long, macho_header 
const*, unsigned long*) + 761
25  dyld0x7fff66e5805e _dyld_start + 54




Thanks

Gideon









___

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 store reject on asl log. How else do I get at the log messages?

2013-05-30 Thread Gideon King
Hi,

My app was rejected from the store because I wanted the entitlement:

com.apple.security.temporary-exception.files.absolute-path.read-only - 
/private/var/log/asl/ 

I need this so I can use the asl_new, asl_set_query, asl_search, 
aslresponse_next, asl_get, and aslresponse_free to be able to get the log 
messages for my application when people submit a bug report.

The app store rejection told me that I need to "investigate other ways of 
implementing the desired functionality".

Are there other ways of getting at the console log entries for my app so I can 
get them sent to me with bug reports?


Regards

Gideon








___

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: Sandboxing and ABAddressBook

2013-05-21 Thread Gideon King
I checked /Library, /System/Library and ~/Library. I presume by network you 
would be referring to some server config, since I don't have a /Network folder 
but I recall seeing one on another machine I worked on in another place.

G.

On 22/05/2013, at 6:43 AM, "Sean McBride"  wrote:

> 
> Did you check all the 'Library's?  In home, root, System, network...
> 


___

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: Sandboxing and ABAddressBook

2013-05-21 Thread Gideon King
I did, but even after I renamed that folder, I still got the error messages. I 
tried it on another machine and didn't get any sandbox errors, so maybe it's 
just something on my machine.

Regards

Gideon



On 22/05/2013, at 3:34 AM, "Sean McBride"  wrote:

> I notice the 'indexPlugins' method in your backtrace.  Do you have anything 
> in Library/Address Book Plug-Ins ?
> 
> Sean
> 
> 
> On Mon, 20 May 2013 18:45:39 +1000, Gideon King said:
> 
>> I have address book data access enabled, but when I do a [ABAddressBook
>> sharedAddressBook] in applicationDidFinishLaunching, it generates a
>> series of sandbox deny file-read-data messages.
>> 


___

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: Widow / Orphan protection in text layout

2013-05-20 Thread Gideon King
Thanks Kyle,

This is actually a bit more than inconvenience - it causes my app to be 
rejected from the app store.

It's all very well overriding -currentTextContainer and returning my ivar, but 
I have no way of knowing if it is used in different parts of the typesetter, so 
could be inadvertently breaking something else, and the lack of access to 
methods of setting the currentTextContainerIndex or currentTextContainerSize 
also appears to be a show stopper.

I have not been able to find any other relevant suggestions about controlling 
pagination in the list archives, apart from a thread where Aki Inoue 
recommended doing exactly what is being done in this code.

As far as I can tell, there is no other API that will allow us to know the 
necessary information during typesetting and cause it to move on to the next 
container.

Given the lack of any other way of doing this, if there are no other 
suggestions, I will go back to the app store approval people and ask for an 
exception for this, but I don't know what my chances are. My previous 
experiences with them have been … less than encouraging.

Regards

Gideon

On 21/05/2013, at 2:02 AM, Kyle Sluder  wrote:

> The typesetter should be performing pagination, somewhere within or below 
> -layoutGlyphsInLayoutManager:startingAtGlyphIndex:maxNumberOfLineFragments: 
> nextGlyphIndex: in the call stack.
> 
> One hint that this is true is in the documentation for -[NSLayoutManager 
> setTextContainer:forGlyphRange:], which notes that it should only be called 
> by the typesetter during layout.
> 
> As for actually keeping track of which text container you're laying into, 
> you're right that accessing those ivars directly is bad form. If you'd like 
> to avoid direct ivar access, add your own ivars that mimic the existing ones 
> and override -currentTextContainer to use them. Then file a radar asking for 
> -[NSTypesetter setCurrentTextContainerIndex:] for use by subclasses.
> 
> (I haven't spent the time thinking about whether -willSetLineFragmentarect:… 
> is the appropriate place to do pagination.)
> 
> --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

Widow / Orphan protection in text layout

2013-05-20 Thread Gideon King
Hi, I have inherited some code which has a subclass of NSATSTypesetter in it, 
and in the -willSetLineFragmentRect:forGlyphRange:usedRect:baselineOffset: 
method it works out whether it needs to put a page break in, and directly sets 
the currentTextContainer, currentTextContainerIndex, and 
currentTextContainerSize instance variables.

This is completely undocumented and presumably a very bad way to handle the 
pagination, so I want to fix it.

The problem is that I am not clear whether the typesetter is the place to do 
the pagination or whether it should be in the layout manager, and if so exactly 
how to handle the processing. Any advice on how best to handle the pagination 
would be most welcome.

Here's what got handed to me (in a subclass of NSATSTypesetter):

- (void)willSetLineFragmentRect:(NSRect *)lineRect 
forGlyphRange:(NSRange)glyphRange usedRect:(NSRect *)usedRect 
baselineOffset:(CGFloat *)baselineOffset {
NSRange characterRange = [self characterRangeForGlyphRange:glyphRange 
actualGlyphRange:NULL];
NSString *string = self layoutManager] textStorage] string] 
substringWithRange:characterRange];
NSSize size = [[self currentTextContainer] containerSize];
// This is more like the forecast maximum y which is the line height plus 
the origin y.
CGFloat forecastedHeight = ((*lineRect).size.height*2.0) + 
(*lineRect).origin.y;

// If the last character of the line fragment is not a paragraph marker, 
and the text is on the last line, then put the text on the next page. This is 
so the
// text is not split so that the character name is on one page and the 
dialog is on another etc
if ([string characterAtIndex:characterRange.length-1] != 
NSParagraphSeparatorCharacter) {
if (forecastedHeight > size.height) {
NSFont *font = [[[self layoutManager] textStorage] 
attribute:NSFontAttributeName atIndex:[self paragraphCharacterRange].location 
effectiveRange:NULL];

NSDictionary *attrs = [[[self layoutManager] textStorage] 
attributesAtIndex:[self paragraphCharacterRange].location effectiveRange:NULL];
NSString *temp = self layoutManager] textStorage] string] 
substringWithRange:[self paragraphCharacterRange]];
NSSize stringSize = [temp sizeWithAttributes:attrs];

lineRect->origin.y = 0.0;
lineRect->size.height = stringSize.height;
usedRect->origin.y = 0.0;
usedRect->size.height = stringSize.height;

*baselineOffset = [[self layoutManager] 
defaultBaselineOffsetForFont:font];

if (currentTextContainer == [[self textContainers] lastObject]) {
currentTextContainerIndex = NSNotFound;
currentTextContainer = nil;
currentTextContainerSize = NSZeroSize;
} else {
unsigned indexOfOldTC = [[self textContainers] 
indexOfObjectIdenticalTo:currentTextContainer];
currentTextContainerIndex = indexOfOldTC+1;
currentTextContainer = [[self textContainers] 
objectAtIndex:currentTextContainerIndex];
currentTextContainerSize = [currentTextContainer containerSize];
}
}
}

// If the line is a character name, then we will always put it down a line 
below whatever section was above it.
NSString *section = [self.screenwriterLayoutManager.screenwriterView 
sectionFromRange:[self paragraphCharacterRange]];
if (section == SWCharacterSectionIdentifier) {
if (forecastedHeight > size.height) {
if (lineRect->origin.y > 0.001) {
NSFont *font = [[[self layoutManager] textStorage] 
attribute:NSFontAttributeName atIndex:[self paragraphCharacterRange].location 
effectiveRange:NULL];

NSDictionary *attrs = [[[self layoutManager] 
textStorage] attributesAtIndex:[self paragraphCharacterRange].location 
effectiveRange:NULL];
NSString *temp = self layoutManager] 
textStorage] string] substringWithRange:[self paragraphCharacterRange]];
NSSize stringSize = [temp 
sizeWithAttributes:attrs];

lineRect->origin.y = 0.0;
lineRect->size.height = stringSize.height;
usedRect->origin.y = 0.0;
usedRect->size.height = stringSize.height;

*baselineOffset = [[self layoutManager] 
defaultBaselineOffsetForFont:font];

if (currentTextContainer == [[self textContainers] lastObject]) 
{
currentTextContainerIndex = NSNotFound;
currentTextContainer = nil;
currentTextContainerSize = NSZeroSize;
} else {
unsigned indexOfOldTC = [[self textContainers] 
indexOfObjectIdenticalTo:currentTextContainer];

Sandboxing and Apple System Log (asl) searches

2013-05-20 Thread Gideon King
Hi,

In my application, I want to be able to collect Apple system log information 
about my application, and have been using asl_new(ASL_TYPE_QUERY); to do so.

Unfortunately this needs to access any files in /private/var/log/asl/*

I understand that there is no way to add an entitlement that will allow access 
to all the files in a folder. Is there any way of either setting up an 
entitlement to allow access to all the files in that folder, or another way to 
read the system logs in a way that is sandbox friendly?


TIA

Gideon








___

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


Sandboxing and ABAddressBook

2013-05-20 Thread Gideon King
Hi,

I have address book data access enabled, but when I do a [ABAddressBook 
sharedAddressBook] in applicationDidFinishLaunching, it generates a series of 
sandbox deny file-read-data messages. 

Interestingly, if I then ask it for "me" it returns correct data, so whatever 
the messages are, it doesn't seem to be stopping it loading at least some of 
the addresses.

I'd like to get rid of the error if possible - any ideas where to look?


0   libsystem_kernel.dylib  0x7fff93ea5fee __open + 10
1   CarbonCore  0x7fff90489f74 PBOpenIteratorSync + 
378
2   CarbonCore  0x7fff90489de2 FSOpenIterator + 28
3   Foundation  0x7fff989cbab3 
_NSDirectoryContentsFromCarbonError + 130
4   Foundation  0x7fff989c9962 -[NSFileManager 
directoryContentsAtPath:matchingExtension:options:keepExtension:error:] + 315
5   Foundation  0x7fff989c9814 -[NSFileManager 
contentsOfDirectoryAtPath:error:] + 36
6   AddressBook 0x7fff96be6716 
-[ABDataSourcePluginIndex sourceBundlePaths] + 940
7   AddressBook 0x7fff96be6118 
-[ABDataSourcePluginIndex indexPlugins] + 94
8   AddressBook 0x7fff96be6050 
-[ABDataSourcePluginIndex bundleForClassName:] + 37
9   AddressBook 0x7fff96be5fce 
-[ABDataSourcePluginIndex loadBundleForClassName:error:] + 31
10  AddressBook 0x7fff96be5e47 +[ABAccountFactory 
sourceClassForClassName:] + 64
11  AddressBook 0x7fff96be5cda -[ABAccountFactory 
localAccount] + 39
12  AddressBook 0x7fff96be5c30 -[ABAccountFactory 
uncachedAccounts] + 53
13  AddressBook 0x7fff96be5a37 
-[ABAccountRepository runWithLockLoadingExistingAccountsIfNecessary:] + 259
14  AddressBook 0x7fff96be588a 
-[ABAccountRepository allAccounts] + 208
15  AddressBook 0x7fff96be577a 
-[ABAccountRepository persistentAccounts] + 17
16  AddressBook 0x7fff96be5139 
-[ABPersistentStoreCoordinatorFactory 
pool_makeCoordinatorForAllAvailableSources] + 102
17  AddressBook 0x7fff96be506c 
ABResultWithAutoreleasePool + 62
18  AddressBook 0x7fff96be501c 
-[ABPersistentStoreCoordinatorFactory makeCoordinatorForAllAvailableSources] + 
73
19  AddressBook 0x7fff96be4de6 
-[ABPersistentStoreCoordinatorCache nts_coordinatorForAllSources] + 102
20  AddressBook 0x7fff96be4d5a 
-[ABPersistentStoreCoordinatorCache coordinatorForAllSources] + 34
21  AddressBook 0x7fff96be4b25 
-[ABAddressBook(ABAddressBook_CoreData_Private) 
nts_managedObjectContextWithStoreDescription:databasePath:loadFailure:] + 163
22  AddressBook 0x7fff96be43e9 
-[ABAddressBook(ABAddressBook_CoreData_Private) managedObjectContext] + 112
23  AddressBook 0x7fff96bdffe3 +[ABAddressBook 
nts_SharedAddressBook] + 186
24  AddressBook 0x7fff96bdfe8a +[ABAddressBook 
nts_CreateSharedAddressBook] + 49
25  AddressBook 0x7fff96bdf1d7 +[ABAddressBook 
sharedAddressBook] + 69
26  NovaMind5   0x00010010e641 
+[NMInformationCollector userName] + 49 (NMInformationCollector.m:36)
27  NovaMind5   0x00010010ec29 
+[NMInformationCollector systemAndUserInformation] + 937 
(NMInformationCollector.m:84)
28  NovaMind5   0x00010004975a -[NMApplication 
applicationDidFinishLaunching:] + 15802 (NMApplication.m:1476)
29  CoreFoundation  0x7fff935d8eda _CFXNotificationPost 
+ 2554
30  Foundation  0x7fff9897fe26 
-[NSNotificationCenter postNotificationName:object:userInfo:] + 64
31  AppKit  0x7fff97a1f55d -[NSApplication 
_postDidFinishNotification] + 292
32  AppKit  0x7fff97a0fc0a -[NSApplication 
finishLaunching] + 2177
33  OmniAppKit  0x0001008b201e -[OAApplication 
finishLaunching] + 206 (OAApplication.m:109)
34  AppKit  0x7fff97a0f04a -[NSApplication run] 
+ 124
35  OmniAppKit  0x0001008b20cf -[OAApplication run] 
+ 127 (OAApplication.m:118)
36  AppKit  0x7fff979b3c06 NSApplicationMain + 
869
37  NovaMind5   0x00011c22 main + 34 (main.m:11)
38  NovaMind5   0x00011bf4 start + 52




TIA

Gideon








___

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

Please do not post admin requests or moderat

Re: Overlapping sibling views

2013-04-30 Thread Gideon King
How did you test it? Did you sort the views at all, or just leave them in the 
order they were instantiated? Did you try Sean's workaround?

Regards

Gideon





On 01/05/2013, at 4:39 AM, Quincey Morris  
wrote:

> 
> Nope. I just tried it again, setting the layer-backed checkboxes all the way 
> up in IB, and it still fails sometimes (about 1 time out of every 20 or 30, 
> today).
> 


___

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: Overlapping sibling views

2013-04-30 Thread Gideon King
So it sounds as if as long as I have all my views in the entire hierarchy layer 
backed, my sibling views should always draw in order. 

This makes me happy :) … and the documentation wrong :(  - I'll report that.


Regards

Gideon



___

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

Overlapping sibling views

2013-04-30 Thread Gideon King
Hi, I had to design my whole view system to work around the problems with 
overlapping sibling views not being guaranteed to be drawn in a specific order, 
but today I came across some posts that suggested that this was no longer the 
case.

In the current 10.8 documentation it still says: "Note: For performance 
reasons, Cocoa does not enforce clipping among sibling views or guarantee 
correct invalidation and drawing behavior when sibling views overlap. If you 
want a view to be drawn in front of another view, you should make the front 
view a subview (or descendant) of the rear view."

But in this thread from 2009, two Apple engineers (Corbin Dunn and David 
Duncan) said that the documentation is out of date, and that it should work as 
of 10.5: 
http://www.cocoabuilder.com/archive/cocoa/228191-nsview-behaves-different-on-10-4-vs-10-5.html

There are conflicting views expressed in 
http://stackoverflow.com/questions/466297/is-there-a-proper-way-to-handle-overlapping-nsview-siblings

My scenario is a whole lot of sibling, potentially translucent, overlapping, 
layer backed views.

I'm fairly sure I tested this and found it to fail in mid 2010, so this would 
make it 10.6.

It also appears that the CocoaSlides example app uses sibling views for the 
slides, and that appears to show the slides in the same order every time.

So, is the problem actually fixed? And if so, what version of the operating 
system introduced the fix?


Regards

Gideon






___

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


Automatic document duplication

2012-11-29 Thread Gideon King
I have an application where documents are created which can have other files 
attached to them. A user can open the file in its native application. I copy 
the original file to a temporary folder (using NSTemporaryDirectory() and 
adding the file name to it) and ask NSWorkspace to open it. 

If the user edits the file, I pick that up when they go back to my application 
and ask them if they want to update the version in their document to be the 
edited version.

All this works fine, and has right through 10.7, and 10.8 *except* for files 
which are opened in Preview. 

As soon as you start editing them you get a message "The original document 
can't be changed, so a duplicate with your changes has been created".

If I open the exact same file in another program and edit it and save it, 
everything works as expected.

Does anyone know why you would get that error message, and how to avoid it? I 
don't understand why Preview would refuse to edit that file in place - is it 
because it is in a temporary folder?


Thanks

Gideon

___

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


Debugging a spotlight importer problem

2012-08-06 Thread Gideon King
I have a spotlight importer that works just fine when I run mdimport from the 
command line, but it fails with a sig11 when it runs automatically. 

I've tested it on two machines under 10.7 and 10.8, with the same results.

Can anyone give any tips on how to debug this situation?

Thanks

Gideon









___

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


Closing connections nicely when DO server crashes

2012-08-03 Thread Gideon King
Hi, I am trying to implement LinkBack in my application, and it creates a 
Distributed Objects connection to send the info to and fro.

It all works fine, but if the server application crashes, I get a crash in my 
application with this backtrace:

* thread #1: tid = 0x2203, 0x7fff8aed5b3e CoreFoundation`___forwarding___ + 
158, stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
frame #0: 0x7fff8aed5b3e CoreFoundation`___forwarding___ + 158
frame #1: 0x7fff8aed5a28 CoreFoundation`_CF_forwarding_prep_0 + 232
frame #2: 0x7fff8809b8e1 Foundation`-[NSDistantObjectTableEntry 
dealloc] + 41
frame #3: 0x7fff8ae5cf9a CoreFoundation`CFRelease + 170
frame #4: 0x7fff8ae84770 CoreFoundation`-[__NSArrayM 
removeObjectAtIndex:] + 400
frame #5: 0x7fff8aedb12f CoreFoundation`-[NSMutableArray 
removeObjectsInRange:] + 111
frame #6: 0x7fff8aedb09f CoreFoundation`-[NSMutableArray 
removeObjectsAtIndexes:] + 527
frame #7: 0x7fff880158f0 Foundation`invalidateConnection + 675
frame #8: 0x7fff88015532 Foundation`-[NSConnection invalidate] + 945
frame #9: 0x7fff880adedd Foundation`+[NSConnection _portInvalidated:] + 
831
frame #10: 0x7fff8ae99b8a CoreFoundation`_CFXNotificationPost + 2554
frame #11: 0x7fff8802fa76 Foundation`-[NSNotificationCenter 
postNotificationName:object:userInfo:] + 64
frame #12: 0x7fff88051237 Foundation`_NSPortDeathNotify + 80
frame #13: 0x7fff8af4139a 
CoreFoundation`CFMachPortChecker_block_invoke_0 + 202
frame #14: 0x7fff912acf3d 
libdispatch.dylib`_dispatch_call_block_and_release + 15
frame #15: 0x7fff912a90fa libdispatch.dylib`_dispatch_client_callout + 8
frame #16: 0x7fff912ae104 
libdispatch.dylib`_dispatch_main_queue_callback_4CF + 275
frame #17: 0x7fff8ae8981e CoreFoundation`__CFRunLoopRun + 1614
frame #18: 0x7fff8ae88dd2 CoreFoundation`CFRunLoopRunSpecific + 290
frame #19: 0x7fff9296f774 HIToolbox`RunCurrentEventLoopInMode + 209
frame #20: 0x7fff9296f512 HIToolbox`ReceiveNextEventCommon + 356
frame #21: 0x7fff9296f3a3 
HIToolbox`BlockUntilNextEventMatchingListInMode + 62
frame #22: 0x7fff869e91d3 AppKit`_DPSNextEvent + 685
frame #23: 0x7fff869e8a92 AppKit`-[NSApplication 
nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
frame #24: 0x7fff869dfe33 AppKit`-[NSApplication run] + 517
frame #25: 0x0001007acbff OmniAppKit`-[OAApplication run] + 127
frame #26: 0x7fff86984886 AppKit`NSApplicationMain + 869
frame #27: 0x000119d2 NovaMind5`main + 34 at main.m:11
frame #28: 0x000119a4 NovaMind5`start + 52

Which in turn causes my application to crash. I have been doing similar tests 
in the other direction with OmniGraffle, and when I force quit my application, 
OmniGraffle will crash in the same way, so I'm pretty sure it's not something 
I'm doing in my code. If the client application crashes, everything is cleaned 
up nicely, but if the server application crashes, this crash results.

Is there some way I can make my application robust to a situation like this? 
I'm not really sure where to start with this...


Thanks

Gideon









___

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: spotlight importer extract file from zip archive

2012-07-25 Thread Gideon King
Cool, got it working thanks.

Gideon

On 26/07/2012, at 12:46 PM, Jens Alfke  wrote:

> 
> On Jul 25, 2012, at 6:57 PM, Gideon King  wrote:
> 
>> How can I get files from my zipped documents without having to run an NSTask?
> 
> Link against libz.dylib?
> 
> —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

spotlight importer extract file from zip archive

2012-07-25 Thread Gideon King
Hi, I am trying to create a spotlight importer, but my files that I want to 
index are zip files, and NSTask will not run from the mdimporter process, since 
it is not blocked by the sandbox. 

How can I get files from my zipped documents without having to run an NSTask?


Thanks

Gideon





___

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 styleMask and full screen

2012-07-19 Thread Gideon King
It turns out that on 10.6+ at least, just setting the button cell to enabled 
does the trick:

NSButton *button = [window standardWindowButton:NSWindowMiniaturizeButton];
NSButtonCell *buttonCell = [button cell];
[buttonCell setEnabled:YES];

Still, it's definitely an Apple bug, and I'll file a bug report.

Regards

Gideon

On 20/07/2012, at 12:16 PM, Lee Ann Rucker  wrote:

> It's an Apple bug - I meant to file it but apparently didn't; I should do 
> that. It's nothing to do with the styleMask; sometimes the window sets the 
> buttonCell's temporarilyDisabled flag and doesn't restore it.
> 
> From a comment in my code:
> * temporarilyDisabled should only be YES when the menubar is hidden, but 
> sometimes
> * the window code gets confused and doesn't reset it for windows that
> * were changing state at the same time as the menu.
> 
> 


___

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 styleMask and full screen

2012-07-19 Thread Gideon King
I have an application where sometimes I need to go full screen. While in full 
screen mode, I need to change the presentation mode so that sometimes the 
menubar and toolbar are autohiding, and sometimes just not shown. Then when I 
exit full screen, I reset the values to what they were before I started.

This works fine, except that when I return from full screen, the minimize 
button is disabled on the window.

So I thought I would record the styleMask of the window before going full 
screen, and then restore it afterwards.

When I ask for the window's styleMask, I get a value of 4111 which according to 
the documentation would be an impossible value. If I just use that value for 
setStyleMask: later in my program, my minimize button is still disabled.

I'm suspecting that Apple must be using the value for other things too, so I 
thought I would use:

oldStyleMask = [window styleMask];

oldStyleMask = oldStyleMask & 
(NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask|NSTexturedBackgroundWindowMask);

… do stuff …

[window setStyleMask:oldStyleMask];

Now when I use the & statement, I get a value of 15, which matches how the 
window looks, but setting the style mask back to that value still doesn't 
enable the minimize button.

I looked around and found a suggestion on stack overflow 
http://stackoverflow.com/questions/7888308/nswindow-loses-miniaturize-button-on-lion,
 but the idea there would only be applicable if I was keeping the same 
application presentation options for the whole time I'm in full screen, which 
is not the case.

I have the same problem on 10.6, and the proposed workaround linked off stack 
overflow doesn't work - presumably because I change the application 
presentation options.

I even thought I would try to be smart and override styleMask with the 
following:

- (NSUInteger)styleMask {
return [super styleMask]|NSMiniaturizableWindowMask;
}

But even that wouldn't enable the miniaturize button!

Does anyone know of a workaround for this?



TIA

Gideon






___

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

Trying to track down a core animation issue

2012-07-19 Thread Gideon King
Hi, I have a problem where it appears that a core animation task is being run 
on something created in a background thread, but the thread is being removed 
before the animation has finished.

I have checked through my code and don't see anything that could be doing this 
explicitly, so am guessing that something is happening implicitly. As 
recommended by the error report, I have turned on the logging, and get the 
following:

CoreAnimation: warning, deleted thread with uncommitted CATransaction; created 
by:
0   QuartzCore  0x7fff8d491b95 
_ZN2CA11Transaction4pushEv + 219
1   QuartzCore  0x7fff8d49176d 
_ZN2CA11Transaction15ensure_implicitEv + 273
2   QuartzCore  0x7fff8d498b6a 
_ZN2CA5Layer12begin_changeEPNS_11TransactionEjRP11objc_object + 44
3   QuartzCore  0x7fff8d498ac8 
_ZN2CA5Layer12set_delegateEP11objc_object + 86
4   AppKit  0x7fff85d2df3a -[NSView 
_finalizeWithReferenceCounting] + 324
5   AppKit  0x7fff85d2ddce -[NSView dealloc] + 
42
6   libobjc.A.dylib 0x7fff8c2792b0 
_ZN12_GLOBAL__N_119AutoreleasePoolPage3popEPv + 464
7   libdispatch.dylib   0x7fff905fa2a8 
_dispatch_worker_thread2 + 410
8   libsystem_c.dylib   0x7fff8c15cceb _pthread_wqthread + 
404
9   libsystem_c.dylib   0x7fff8c1471b1 start_wqthread + 13

So some view somewhere is being deallocated while it still has an animation 
running. But there are many views created for different things in my code, and 
putting a breakpoint on NSView's dealloc would be very time consuming, and 
putting a breakpoint on _ZN2CA11Transaction4pushEv didn't help since it is 
called whenever the window is activated, so I can't get to my application. I 
guess I could log it and continue, but that's not going to give me anything 
where I can identify the view.

I'm looking for suggestions on how to track down which view it is that is 
causing the problem. 

Thanks. (I'm sure I must be missing something blindingly obvious on how to 
track this down, but right now I'm drawing a blank).



Gideon
___

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: NSSplitView question - how to implement my own "adjustViews" style method

2012-07-18 Thread Gideon King
I always use RBSplitView - has all that stuff built in and more…

http://brockerhoff.net/blog/tag/rbsplitview/

Seems to work fine for my needs.

Regards

Gideon




On 03/07/2012, at 2:40 PM, Motti Shneor  wrote:

> Thanks Graham (Sigh…)
> 
> I was beginning to think I'm stupid or something, struggling so hard with a 
> UI element as ordinary as a Split-View.
> 
> 
> On 3 ביול 2012, at 03:14, Graham Cox wrote:
> 
>> 
>> On 03/07/2012, at 12:21 AM, Motti Shneor wrote:
>> 
>>> I really need an advice here.
>> 
>> 
>> This will sound flippant but it's not meant to be: implement your own split 
>> view.
>> 

___

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: Icon Overlay on Mac OSX

2012-07-17 Thread Gideon King
You might like to check out CTBadge - there are a couple of minor memory issues 
in the current release which will be picked up in Xcode's analyze function, but 
apart from that, it will probably point you in the right direction.

http://blog.oofn.net/2006/01/08/badging-for-everyone/


Regards

Gideon


On 09/07/2012, at 3:34 PM, Alfian Busyro  wrote:

> Hi,
> 
> I'm a newbie in Cocoa framework, XCode and also Obj-C.
> I'm still struggling to create an icon overlay in finder like the one in that 
> dropbox did.

___

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: Problem adding subview to NSScroller subclass

2012-07-08 Thread Gideon King
Excellent, thanks Lee Ann. 

>From the look of the code, the accessory view will be shown all the time. I 
>guess I have a UI decision to make as to whether to have just my zoom controls 
>showing all the time and overlay scrollers (which may look a bit funny, but 
>gives you maximum room), or using legacy scrollers, or moving the zoom 
>controls somewhere else, or maybe making the view translucent until you mouse 
>over it or something... I see that Keynote has an entire bottom bar dedicated 
>to just a single zoom control which seems rather wasteful.

Regards

Gideon


On 08/07/2012, at 3:04 PM, Lee Ann Rucker  wrote:

> You've totally hit what I hit when Lion first came out, and it was my big 
> WWDC question that year - took two Apple engineers digging in the code to 
> figure it out; turned out to be a bug lurking since the NeXT days that only 
> gets triggered when you add subviews to the scrollview and use overlay 
> scrollers.
> 
> This is what we wrote at WWDC - it works on 10.6 & up:
> ...


___

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: Problem adding subview to NSScroller subclass

2012-07-07 Thread Gideon King
>From memory I think the drawing problems only happened when I was trying to 
>use overlay scrollers.

With my own scroller implementation, I wondered what was going on, and I see 
that the backtrace is totally different when I am using overlay scrollers:
frame #0: 0x000100463304 NovaMind5`-[NMPresentableScroller drawRect:] + 
148 at NMPresentableScroller.m:90
frame #1: 0x7fff838870b2 AppKit`-[NSSurface displayIfNeeded] + 266
frame #2: 0x7fff839a9d0d AppKit`-[NSView 
_recursiveSyncAndDisplayViewBackingSurfacesIfNeeded:] + 212
frame #3: 0x7fff87e2f0b6 CoreFoundation`__NSArrayEnumerate + 582
frame #4: 0x7fff839a9df6 AppKit`-[NSView 
_recursiveSyncAndDisplayViewBackingSurfacesIfNeeded:] + 445
frame #5: 0x7fff87e2f0b6 CoreFoundation`__NSArrayEnumerate + 582
frame #6: 0x7fff839a9df6 AppKit`-[NSView 
_recursiveSyncAndDisplayViewBackingSurfacesIfNeeded:] + 445
frame #7: 0x7fff87e2f0b6 CoreFoundation`__NSArrayEnumerate + 582
frame #8: 0x7fff839a9df6 AppKit`-[NSView 
_recursiveSyncAndDisplayViewBackingSurfacesIfNeeded:] + 445
frame #9: 0x7fff87e2f0b6 CoreFoundation`__NSArrayEnumerate + 582
frame #10: 0x7fff839a9df6 AppKit`-[NSView 
_recursiveSyncAndDisplayViewBackingSurfacesIfNeeded:] + 445
frame #11: 0x7fff87e2f0b6 CoreFoundation`__NSArrayEnumerate + 582
frame #12: 0x7fff839a9df6 AppKit`-[NSView 
_recursiveSyncAndDisplayViewBackingSurfacesIfNeeded:] + 445
frame #13: 0x7fff87e2f0b6 CoreFoundation`__NSArrayEnumerate + 582
frame #14: 0x7fff839a9df6 AppKit`-[NSView 
_recursiveSyncAndDisplayViewBackingSurfacesIfNeeded:] + 445
frame #15: 0x7fff83a20683 AppKit`-[NSView 
_recursiveSyncDisplayAndFlushViewBackingSurfacesIfNeeded] + 96
frame #16: 0x7fff83970c8a AppKit`-[NSView 
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 1168
frame #17: 0x7fff8393b993 AppKit`-[NSView displayIfNeeded] + 1830

versus normal drawing:
frame #0: 0x000100463304 NovaMind5`-[NMPresentableScroller drawRect:] + 
148 at NMPresentableScroller.m:90
frame #1: 0x7fff83979e20 AppKit`-[NSView _drawRect:clip:] + 4437
frame #2: 0x7fff83976c93 AppKit`-[NSView 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 + 3058
frame #3: 0x7fff83977724 AppKit`-[NSView 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 + 5763
frame #4: 0x7fff83977724 AppKit`-[NSView 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 + 5763
frame #5: 0x7fff83977724 AppKit`-[NSView 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 + 5763
frame #6: 0x7fff83977724 AppKit`-[NSView 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 + 5763
frame #7: 0x7fff83977724 AppKit`-[NSView 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 + 5763
frame #8: 0x7fff83977724 AppKit`-[NSView 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 + 5763
frame #9: 0x7fff83975e23 AppKit`-[NSThemeFrame 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 + 314
frame #10: 0x7fff83971a3d AppKit`-[NSView 
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 4675
frame #11: 0x7fff8393b993 AppKit`-[NSView displayIfNeeded] + 1830

So I wondered what would happen if I used setWantsLayer:YES on my accessory 
view, and low and behold it is now drawn on my 10.7+ style overlay views! Yay!

It doesn't auto-hide, and it only actually works when the scrollers are shown, 
so I'm not sure that it's going to be that useful anyway. I thought the 
auto-hiding might be done through the opacity of a backing layer on the view, 
but there is apparently no layer on this view (!). I logged setAlphaValue: and 
it wasn't called, so am not sure where the opacity is coming from.

If I can get it to auto-hide with the scroller, and make the scrollers stay 
visible when the control is in use (it's sometimes a popup button, and 
sometimes a text field), then it may work out well. Otherwise, I may just have 
to stick with using either always visible scrollers, or find another location 
for my zoom controls.

At least I 

Regards

Gideon

On 08/07/2012, at 12:21 PM, Graham Cox  wrote:

> 
> On 08/07/2012, at 12:13 PM, Gideon King wrote:
> 
>> Yes, I was using that type of code before too, but it didn't work with the 
>> new scrollbar styles (drawing artifacts on resize, not automatically 
>> hiding), which is what prompted me to look at subclassing the scroller 
>> itself instead. Unfortunately it still only works with the legacy style 
>> scro

Re: Problem adding subview to NSScroller subclass

2012-07-07 Thread Gideon King
Yes, I was using that type of code before too, but it didn't work with the new 
scrollbar styles (drawing artifacts on resize, not automatically hiding), which 
is what prompted me to look at subclassing the scroller itself instead. 
Unfortunately it still only works with the legacy style scrollers and not 
overlays as per my previous message.

Regards

Gideon

On 08/07/2012, at 11:04 AM, Graham Cox  wrote:

> 
> On 07/07/2012, at 6:38 PM, Gideon King wrote:
> 
>> Has anybody successfully added a subview to an NSScroller?
> 
> 
> Yes, but more recently I took it out again and moved that extra view 
> elsewhere, because on Lion/Mountain Lion, these scroll areas are handled 
> differently and the presence of an extra view is detected and used to revert 
> the scroller to the "legacy" scrollbar design, which is going to look 
> increasingly out of place as apps adopt the new one. This extra 
> special-casing could also be affecting whether and how your view is drawn. 
> That said my code worked on Lion, it just used the legacy scrollbars.
> 
> My subclass of NSScrollView only overrides one method - tile, and adds a 
> property, 'placard' which is the extra view to insert. I believe this code 
> originally was derived from someone else's example I found on the web in 
> about 2003, so I'm not trying to claim it as my own. It does work however.
> 
> 
> --Graham
> 
> 

___

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: Problem adding subview to NSScroller subclass

2012-07-07 Thread Gideon King
Yes, you are correct - I was just drawing the frame of the accessory view as a 
sanity check, and it worked as expected.

It turns out that the problem is with the 10.7+ overlay scroller drawing. If I 
return NO from +isCompatibleWithOverlayScrollers then it all works as expected. 
If I return YES, then my subview is not drawn. The subview is present as a 
subview of the scroll view and in the right place, but not shown.

Any ideas?


Regards

Gideon




On 08/07/2012, at 7:08 AM, Andy Lee  wrote:

> I took that to mean he was drawing the frame of the accessory view with 
> something like NSFrameRect(), not sending a draw message to the accessory 
> view. Come to think of it, this answers one of my questions. Assuming the 
> test code is something like...
> 
>// Sanity-check the frame of the accessory view.
>[[NSColor redColor] set];
>NSFrameRect([accessoryView frame]);
> 
> ...it would appear the accessory view has the right frame. My only remaining 
> question then is to confirm that the accessory view really is a subview of 
> the NSScroller, which is easily checked with a breakpoint in the above code.
> 
> When is the superview-subview relationship established? Is *that* code 
> getting called?
> 
> --Andy
> 
> On Jul 7, 2012, at 4:23 PM, Kyle Sluder wrote:
> 
>> On Jul 7, 2012, at 1:38 AM, Gideon King  wrote:
>> 
>>> 
>>> I overrode the drawSelf: method and got it to draw the frame of the 
>>> accessory view, to make sure it was positioned correctly, and it drew in 
>>> the right place.
>> 
>> Wait, you told another view to draw from within a separate view's 
>> -drawRect:? That's not going to work; the coordinate systems aren't set up 
>> right.
>> 
>> --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


Problem adding subview to NSScroller subclass

2012-07-07 Thread Gideon King
Hi all, I am creating a subclass of NSScroller so that I can add an accessory 
view. I have worked out the position to add it, and added it as a subview, but 
it is never drawn.

I have overridden the rectForPart: method to adjust the scroller size, and that 
leaves the gap as it should.

I overrode the drawSelf: method and got it to draw the frame of the accessory 
view, to make sure it was positioned correctly, and it drew in the right place.

Any ideas what I might be missing? Has anybody successfully added a subview to 
an NSScroller?


Thanks

Gideon







___

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: Color Panel oddity

2012-06-08 Thread Gideon King
I believe that's what you get if you specify the NSColorPanelWheelModeMask for 
the picker mask. Since there is only one mode available it doesn't need to 
display the toolbar.

Regards

Gideon


On 09/06/2012, at 12:12 PM, Dave DeLong  wrote:

> Try this: http://www.apptree.net/images/colourpanel.png
> 
> On Jun 8, 2012, at 7:10 PM, Kyle Sluder wrote:
> 
>> On Jun 8, 2012, at 5:55 PM, Graham Cox  wrote:
>> 
>>> 
>>> A user is reporting this strange state of the Color Panel:
>>> 
>>> 
>> 


___

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: NSFileManager copyItemAtPath:toPath:error: error on 10.6

2012-05-14 Thread Gideon King
OK, I have looked at the user info dictionary of the error, and see the file 
that is causing the problem:

UserInfo: {
NSDestinationFilePath = "/Users/gideon/Library/Application Support/NovaMind 
5/NovaMind 5 5.3.0/NovaMind5.app/Contents/Resources/ruby/lib/libruby-static.a";
NSFilePath = 
"/Volumes/DEDB91B6-6EA0-4AE2-B038-94056AD36D54/NovaMind5.app/Contents/Resources/ruby/lib/libruby-static.a";
NSUserStringVariant = Copy;
}

Using the file command, I get the following information:
libruby-static.a: Mach-O universal binary with 1 architecture
libruby-static.a (for architecture i386):   current ar archive random 
library

And ls -l@ tells me:

-rw-r--r--@ 1 gideon  staff  8359196 15 May 11:13 libruby-static.a
com.apple.cs.CodeDirectory  123 
com.apple.cs.CodeRequirements12 
com.apple.cs.CodeSignature 4371 

I have not changed anything about this file or how it is processed during 
builds, since the last version that worked.

I see that the old version of Sparkle I was using  used to use FSCopyObjectSync 
to copy the files, and that seemed to work, so I have just put something in so 
that if using 10.7 or later, it uses NSFileManager, and on 10.6 it uses 
FSCopyObjectSync - at least that gets me something that works quickly, but if 
anyone knows why this might fail when using NSFileManager's method on 10.6, I'd 
be keen to know...


Regards

Gideon



___

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


NSFileManager copyItemAtPath:toPath:error: error on 10.6

2012-05-14 Thread Gideon King
Hi, I am having a problem with using NSFileManager's 
copyItemAtPath:toPath:error: in OSX 10.6 - this does not cause a problem on 
10.7. The code being executed is part of the current version of Sparkle. The 
following logs show items successfully copied:

copy from: 
/Volumes/E010E195-C798-4CF5-9D87-F29B33E4481F/.com.apple.timemachine.supported 
to: /Users/gideon/Library/Application Support/NovaMind 5/NovaMind 5 
5.3.0/.com.apple.timemachine.supported
copy from: /Volumes/E010E195-C798-4CF5-9D87-F29B33E4481F/.DS_Store to: 
/Users/gideon/Library/Application Support/NovaMind 5/NovaMind 5 5.3.0/.DS_Store
copy from: /Volumes/E010E195-C798-4CF5-9D87-F29B33E4481F/.fseventsd to: 
/Users/gideon/Library/Application Support/NovaMind 5/NovaMind 5 5.3.0/.fseventsd
copy from: /Volumes/E010E195-C798-4CF5-9D87-F29B33E4481F/.vbt5 
to:/Users/gideon/Library/Application Support/NovaMind 5/NovaMind 5 5.3.0/.vbt5
copy from: /Volumes/E010E195-C798-4CF5-9D87-F29B33E4481F/Applications 
to:/Users/gideon/Library/Application Support/NovaMind 5/NovaMind 5 
5.3.0/Applications
copy from: /Volumes/E010E195-C798-4CF5-9D87-F29B33E4481F/DMG_background.png 
to:/Users/gideon/Library/Application Support/NovaMind 5/NovaMind 5 
5.3.0/DMG_background.png

Then it gets to this one:
copy from: /Volumes/E010E195-C798-4CF5-9D87-F29B33E4481F/NovaMind5.app to: 
/Users/gideon/Library/Application Support/NovaMind 5/NovaMind 5 
5.3.0/NovaMind5.app

which fails with this error:
Error Domain=NSPOSIXErrorDomain Code=7 UserInfo=0x11bdc61f0 "The operation 
couldn’t be completed. Argument list too long"


I have used previous versions of Sparkle with no issues, and have not changed 
my method of producing the disk image that is being installed. I'm not clear as 
to what the argument list is that could be too long.

Any suggestions as to what could be going wrong?


TIA

Gideon








___

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: Need help filtering mouse events in an overlay child window

2012-05-11 Thread Gideon King
Hi Michael

I have had to do this same thing, and have encountered the same problem. 

In my case the main thing I wanted to accomplish was to get the scroll view in 
the main window to reflect the scroll position of my overlay window. It was not 
working very well, but then in my main window, I turned off scrollsDynamically 
then did a scrollPoint, then turned the scrollsDynamically back on again. I'm 
not sure if that is relevant to your situation.

That made it significantly better, but it's still not the same as scrolling in 
the main window when I don't have the overlay window there, so if you find out 
any more info, I'd be keen to hear.

For sending events to the main window from the overlay, I have been creating a 
new event from the existing event like this:

NSEvent *newEvent = [NSEvent 
mouseEventWithType:[theEvent type] 

   location:mapWindowPoint

  modifierFlags:[theEvent modifierFlags] 

  timestamp:[theEvent timestamp] 

   windowNumber:[parentWindow windowNumber]

context:[NSGraphicsContext 
graphicsContextWithWindow:parentWindow]

eventNumber:[theEvent eventNumber]+1 

 clickCount:[theEvent clickCount]

   pressure:[theEvent pressure]];

[NSApp postEvent:newEvent 
atStart:NO];

Where mapWindowPoint is the event location converted to the location in the 
parent window's coordinates, and incrementing the event number is just a guess 
at what I might be supposed to do (seems to work).

I'm also curious to know whether there is any advantage or disadvantage to 
using the NSOperationQueue to close your window instead of using 
performSelector:withObject:afterDelay:

Regards

Gideon



On 12/05/2012, at 11:35 AM, Michael Crawford wrote:

> I'd like to act on -mouseDown when it occurs within the bounds of an 
> NSImageView, which is a subview of a transparent overlay child window.  Some 
> of you may be wondering why I'm trying to do this so I'll try to explain that 
> up front.  There are bugs in Snow Leopard regarding the use of Core Animation 
> with layer-backed views and NSOutlineView.  In order to avoid these bugs, 
> which I'm told Apple will not be fixing for 10.6, I'm using a transparent 
> overlay to do the required animation and implement something like QuickLook 
> or a preview function.
> 
> I tried the following code but it resulted in really bad latency and 
> coordinate issues (I think) in the parent window's event handling.
> 
> #pragma mark - NSEvent Handling Methods
> 
> - (void)mouseDown:(NSEvent *)event
> {
>[self.parentWindow sendEvent:event];
> #if 0
>[super mouseDown:event];
>[self.parentWindow removeChildWindow:self];
>[[NSOperationQueue mainQueue] addOperationWithBlock:^{
>[self close];
>}];
> #endif
> }
> 
> 
> I'm thinking that the way I'm forwarding events to the parent is wrong.  So 
> I'm looking for advice on implementing a proper mouse filter that can forward 
> events and generate the same result as if the event was originally sent to 
> the parent window.
> 
> -Michael
> ___
> 
> 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/gideon%40novamind.com
> 
> This email sent to gid...@novamind.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: Using services to email file in document based app

2012-05-11 Thread Gideon King
Thanks Ken, moving it to my window controller got my validRequestorForSendType 
called, but the services menu now shows up with just one item: "Notebook 
Clipping Setup".

So as it stands, this is my code:

+ (void)initialize {
[NSApp registerServicesMenuSendTypes:[NSArray 
arrayWithObject:NSFilenamesPboardType] returnTypes:nil];
}

- (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString 
*)returnType {
if ([sendType isEqualToString:NSFilenamesPboardType]) {
NSDocument *d = [self document];
if ([d fileURL] && ![[self window] isDocumentEdited]) {
return self;
}
}
return nil;
}

- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard types:(NSArray 
*)types {
if ([types containsObject:NSFilenamesPboardType]) {
NSDocument *d = [self document];
if ([d fileURL] && ![[self window] isDocumentEdited]) {
[pboard setString:[[d fileURL] path] forType:NSFilenamesPboardType];
return YES;
}
}
return NO;
}

With this type registeredI see that the validRequestorForSendType is called 
asking for the following types:
com.apple.flat-rtfd
dyn.agu8y6y4grf0gn5xbrzw1gydcr7u1e3cytf2gn
NeXT Rich Text Format v1.0 pasteboard type
NeXT RTFD pasteboard type
NSFilenamesPboardType
NSStringPboardType
public.rtf
public.utf8-plain-text

If I have a dirty document, or one that has just been created, the services 
menu is empty as expected. However, when I have a saved document selected, the 
only item that shows up is the notebook clipping setup.

Seeing as the service I want to be available is specified in the mail 
info.plist using the NSFilenamesPboardType, I'm not sure where else the problem 
could lie.

Anyone have any other suggestions?


Thanks

Gideon



On 11/05/2012, at 7:17 PM, Ken Thomases wrote:

> 
> That service is defined in Mail's Info.plist and it takes 
> NSFilenamesPboardType.
> 
>> I then put breakpoints in the other two methods, but they were never called.
> 
> The Services docs say that the latter two methods must be on an NSResponder 
> object, like a view or window.  I recognize that the document is in the 
> responder chain for action messages, but that may not suffice for this case.  
> The docs also say:
> 
> "The validRequestorForSendType:returnType: message is sent along an abridged 
> responder chain, comprising only the responder chain for the key window and 
> the application object."
> 
> 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


Using services to email file in document based app

2012-05-11 Thread Gideon King
Hi, I would like my document based app to be able to send its files as email 
attachments. I notice that the Finder has the services option to send a file as 
an attachment, and kind of thought that something like that might have been 
built in to the document architecture, but apparently not. It does appear to be 
a standard service that is available and listed in the system preferences.

I assumed that if I wanted to try this out, I should be able to do something 
like this in my NSDocument subclass:

+ (void)initialize {
[NSApp registerServicesMenuSendTypes:[NSArray 
arrayWithObjects:NSFilenamesPboardType, NSFileContentsPboardType, 
NSURLPboardType, NSFilesPromisePboardType, nil] returnTypes:nil];
}

- (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString 
*)returnType {
return nil;
}

- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard types:(NSArray 
*)types {
return NO;
}

(assuming that the "New Email With Attachment" service would take one of the 
pasteboard types I had specified). I then put breakpoints in the other two 
methods, but they were never called.

I realize that there are other ways that something like this could be 
accomplished, but seeing as the service is there, I wanted to try to get it 
working that way. 

Can anyone enlighten me on how this is supposed to be done?


Thanks

Gideon






___

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


Any clues on what could cause this crash?

2012-04-30 Thread Gideon King
I received this crash report from a user, and have no idea where to look in my 
code for a cause. I'm assuming from the method names etc that it's having 
trouble when drawing a CALayer using OpenGL. I really do nothing strange in my 
code with CALayers. I have a whole bunch of CALayers in a layer hosting view, 
which I populate just by setting their contents to an NSImage, and some 
CAShapeLayers where I am using the paths.

Thread 7 Crashed:: CVDisplayLink
0   com.apple.GeForceGLDriver   0x00020035941f 0x2 + 3511327
1   com.apple.GeForceGLDriver   0x0002000b2fd0 gldUpdateDispatch + 
85
2   GLEngine0x00010b2104cc 
gleDoDrawDispatchCore + 421
3   GLEngine0x00010b1b81f8 
glDrawRangeElements_IMM_Exec + 275
4   com.apple.QuartzCore0x7fff8dbfc954 
CA::OGL::GLContext::draw_elements(CA::OGL::PrimitiveMode, unsigned int, 
unsigned short const*, CA::OGL::Vertex const*, unsigned int, unsigned int, 
CA::OGL::ClipPlane const*) + 392
5   com.apple.QuartzCore0x7fff8dbfc7c5 
CA::OGL::Context::array_flush() + 103
6   com.apple.QuartzCore0x7fff8dc0c237 
CA::OGL::emit_combine_(CA::OGL::Context&, CA::OGL::TextureFunction, 
CA::OGL::Surface*, int, CA::OGL::Surface*, int, CA::OGL::Surface*, int, 
CA::Shape const*, CA::Vec4 const&) + 1290
7   com.apple.QuartzCore0x7fff8dc0b806 
CA::OGL::CombineNode::apply(CA::OGL::Surface**) + 130
8   com.apple.QuartzCore0x7fff8dbf9432 
CA::OGL::ImagingNode::render(CA::OGL::ImagingNode::RenderClosure*) + 160
9   com.apple.QuartzCore0x7fff8dbf9359 
CA::OGL::render_layers(CA::OGL::Renderer&, CA::OGL::Layer*) + 130
10  com.apple.QuartzCore0x7fff8dbf9649 
CA::OGL::LayerNode::apply(CA::OGL::Surface**) + 267
11  com.apple.QuartzCore0x7fff8dbf9432 
CA::OGL::ImagingNode::render(CA::OGL::ImagingNode::RenderClosure*) + 160
12  com.apple.QuartzCore0x7fff8dbf9359 
CA::OGL::render_layers(CA::OGL::Renderer&, CA::OGL::Layer*) + 130
13  com.apple.QuartzCore0x7fff8dbe622c 
CA::OGL::Renderer::render(CA::Render::Update const*) + 684
14  com.apple.QuartzCore0x7fff8dcacfd3 
CA::OGL::render(CA::OGL::Renderer&, CA::Render::Update*) + 243
15  com.apple.QuartzCore0x7fff8dc402b1 
_ZL9view_drawP7_CAViewdPK11CVTimeStampb + 4054
16  com.apple.QuartzCore0x7fff8dc3f2a2 
_ZL17view_display_linkdPK11CVTimeStampPv + 134
17  com.apple.QuartzCore0x7fff8dc3f122 link_callback + 246
18  com.apple.CoreVideo 0x7fff8e44e80f 
CVDisplayLink::performIO(CVTimeStamp*) + 259
19  com.apple.CoreVideo 0x7fff8e44db0c 
CVDisplayLink::runIOThread() + 662
20  com.apple.CoreVideo 0x7fff8e44d85d _ZL13startIOThreadPv 
+ 148
21  libsystem_c.dylib   0x7fff963058bf _pthread_start + 335
22  libsystem_c.dylib   0x7fff96308b75 thread_start + 13

Thread 7 crashed with X86 Thread State (64-bit):
  rax: 0x000101a0ac00  rbx: 0x0033  rcx: 0x0099  
rdx: 0x0036
  rdi: 0x00010001  rsi: 0xb0001064e36e  rbp: 0x00010b11bbd0  
rsp: 0x00010b11bbb0
   r8: 0x0001019f2c00   r9: 0x0001061bb020  r10: 0x000101a0ac00  
r11: 0x00c1
  r12: 0x00010134af60  r13: 0xfafafafa  r14: 0x00010635ba40  
r15: 0x0001064e29e0
  rip: 0x00020035941f  rfl: 0x00010297  cr2: 0x000100c7cc1e

Any ideas on where to look would be greatly appreciated.




Thanks

Gideon
___

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


Converting CGPathAddArcToPoint (or NSBezierPath equivalent) to a fixed number of CGPathAddCurveToPoint calls

2012-04-30 Thread Gideon King
Hi, I am using the CAShapeLayer's ability to animate a path, but the start and 
end path need to have the same number of segments. 

I have been using CGPathAddArcToPoint to add the curves to my path. That 
translates to CGPathAddCurveToPoint calls behind the scenes, but sometimes it 
adds one curve and sometimes two, which means that the curve can't be animated. 

I therefore need to be able to approximate the arc with the same number of 
CGPathAddCurveToPoint calls each time (presumably 2 or 3).

Has anyone done this already either with CGPaths or NSBezierPaths? Any pointers 
would be most welcome.


Thanks

Gideon








___

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


Problem with capturing view contents

2012-04-24 Thread Gideon King
Hi, I have a view I am trying to capture using the following code:

NSBitmapImageRep *rep = [view bitmapImageRepForCachingDisplayInRect:[view 
bounds]];
[view cacheDisplayInRect:[view bounds] toBitmapImageRep:rep];

My view coordinates in a typical test case are as follows:

"01_frame" = "{{0, 0}, {350, 190}}";
"02_bounds" = "{{-98, -95}, {350, 190}}";

The image rep created is the right size, but the contents are drawn up and to 
the right in the image rep (by 98,95 pixels).

If I instead use the frame, the contents are in the right place in the image 
rep, but it only includes the portions of the image with positive x and y 
values (bottom right seeing as it's a flipped view).

If I create an image that is bigger by the amount of the negative origins of 
the bounds, the entire thing is drawn, but then I would need to crop the image 
afterwards, which would be very messy and memory hungry since my views can get 
pretty big.

I tried applying an affine transform before grabbing it, but that made no 
difference.

So is it possible to capture views where the bounds go into the negatives, and 
if so, how?

 
TIA

Gideon
___

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: Example implementation of NSAnimatablePropertyContainer?

2012-03-27 Thread Gideon King
I'd be interested in this too. 

In the past, I have created a subclass of NSView and just used the animation 
capabilities without ever inserting it in a view hierarchy, and that worked, 
but that was just a quick and dirty hack project - I'd like to know how to do 
it properly…

Regards

Gideon

On 28/03/2012, at 12:34 AM, Kenneth Baxter wrote:

> I have some objects that I want to use implicit animations for, but they are 
> not views. 
> 
> I understand that I should be able to implement the 
> NSAnimatablePropertyContainer protocol and it should just work from there. 
> 
> Unfortunately the documentation seems pretty light on how to implement the 
> protocol yourself, what the animator should return, etc. I have not been able 
> to find any example code to show how you would do this. Is there an example 
> around somewhere?
> 
> Thanks
> 
> 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/gideon%40novamind.com
> 
> This email sent to gid...@novamind.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: notAKeyMarker crash

2012-03-05 Thread Gideon King
Ah, of course - silly me. Working on assumptions instead of using my eyes.

So the relevant code is this:
NSMapInsertKnownAbsent(windowsForSheets, sheet, docWindow);
and seeing as windowForSheets is created with:
windowsForSheets = NSCreateMapTable(NSObjectMapKeyCallBacks, 
NSObjectMapValueCallBacks, 0);
and NSObjectMapKeyCallBacks has a nil notAKeyMarker…

So if the sheet is nil, then an exception is raised. Not sure how that would be 
possible in my code, but at least I now understand what is going on.

Regards

Gideon



On 06/03/2012, at 10:42 AM, Mike Abdullah wrote:

> -[OAApplication 
> beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:]
> 
> That's definitely not part of Cocoa! You have the source. Dig in to find the 
> problem.
> 
> On 5 Mar 2012, at 15:15, Gideon King wrote:
> 
>> Hi, I am getting occasional reports of an exception from users of my 
>> software, but they are not able to reproduce it, and nor am I.
>> 
>> I have a sheet which has an NSCollectionView on it and a couple of buttons 
>> and a slider. The NIB also instantiates an array controller which is used as 
>> the content for the collection view.
>> 
>> This is the exception I get:
>> 
>> *** NSMapInsertKnownAbsent(): attempt to insert notAKeyMarker
>> 
>> 0 CoreFoundation 0x7fff896a9fc6 __exceptionPreprocess + 198
>> 1 libobjc.A.dylib 0x7fff855ced5e objc_exception_throw + 43
>> 2 CoreFoundation 0x7fff896a9dfa +[NSException raise:format:arguments:] + 
>> 106
>> 3 CoreFoundation 0x7fff896a9d84 +[NSException raise:format:] + 116
>> 4 Foundation 0x7fff890f67bc -[NSClassicMapTable 
>> setItem:forKnownAbsentKey:] + 74
>> 5 OmniAppKit 0x00010051f008 -[OAApplication 
>> beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:] + 184
>> 
>> I do not instantiate an NSClassicMapTable explicitly in my code, but am 
>> assuming that either the array controller or the collection view uses such 
>> things.
>> 
>> I have never been able to reproduce the problem myself, either in a test 
>> environment or anywhere else either on 10/6 or 10.7 (users have reported it 
>> on both operating system versions).
>> 
>> If anyone has any suggestions as to where to look for this, I'd be very 
>> grateful.
>> 
>> 
>> Regards
>> 
>> Gideon
>> 
>> 
>> 
>> 
>> 
>> 
>> ___
>> 
>> 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/cocoadev%40mikeabdullah.net
>> 
>> This email sent to cocoa...@mikeabdullah.net
> 


___

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

notAKeyMarker crash

2012-03-05 Thread Gideon King
Hi, I am getting occasional reports of an exception from users of my software, 
but they are not able to reproduce it, and nor am I.

I have a sheet which has an NSCollectionView on it and a couple of buttons and 
a slider. The NIB also instantiates an array controller which is used as the 
content for the collection view.

This is the exception I get:

*** NSMapInsertKnownAbsent(): attempt to insert notAKeyMarker

0 CoreFoundation 0x7fff896a9fc6 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x7fff855ced5e objc_exception_throw + 43
2 CoreFoundation 0x7fff896a9dfa +[NSException raise:format:arguments:] + 106
3 CoreFoundation 0x7fff896a9d84 +[NSException raise:format:] + 116
4 Foundation 0x7fff890f67bc -[NSClassicMapTable setItem:forKnownAbsentKey:] 
+ 74
5 OmniAppKit 0x00010051f008 -[OAApplication 
beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:] + 184

I do not instantiate an NSClassicMapTable explicitly in my code, but am 
assuming that either the array controller or the collection view uses such 
things.

I have never been able to reproduce the problem myself, either in a test 
environment or anywhere else either on 10/6 or 10.7 (users have reported it on 
both operating system versions).

If anyone has any suggestions as to where to look for this, I'd be very 
grateful.


Regards

Gideon






___

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: Dumb question about radio buttons

2012-02-24 Thread Gideon King
Not sure about your number of items in your matrix, but you are wanting [sender 
selectedTag] to get the user's choice.

Regards

Gideon 

On 23/02/2012, at 11:58 PM, William Squires wrote:

> 
> -(IBAction)baseChanged:(id)sender
> {
> int choice = [sender tag];
> }
> 
> I always get, "user chose hexadecimal"! :( (all the buttons generate an 
> action, so it's not that...)


___

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: iCal Integration

2012-02-24 Thread Gideon King
I don't see anything in the API to detect it - I have encountered calendars 
that don't support tasks, and if I try to save a task to them, I get an error 
with code 1025 (CalCalendarNotEditableError), and deal with that in my code. 

isEditable returns YES for a calendar which only supports events, so you still 
have to try to save a task to it before you know it won't store tasks.

I haven't come across one that can't save events yet. Do you know what error 
code you get back when you try to save an event to a calendar which doesn't 
support events? I'm assuming it's the same code?

I haven't looked at the "type" property to see if the values there bear any 
relationship to what can be saved to it, but that seems like the only other 
property that could potentially be relevant…


HTH

Gideon


On 23/02/2012, at 1:19 PM, Jeremy Matthews wrote:

> I have a simple app which, as a byproduct, creates tasks and events in iCal. 
> Prior to 10.7, the user would choose from a popup list populated by all 
> calendars within the [CalCalendarStore defaultstore], which worked great and 
> created both events and tasks perfectly fine.
> 
> Now, in 10.7, it seems as if a CalDAV (alal iCloud) or Exchange calendar is 
> separated into two separate objects - one for events and one for tasks, and 
> the result is the user is shown a list of calendars...and in many cases users 
> appear to see duplicates, when in reality there are those two separate 
> "calendars".
> 
> So now, when a user selects the calendar, they might get an event created, 
> but not tasks, and vice-versa. 
> 
> Is there any known way of dealing with this, or any way to easily find out 
> which "calendar" supports events vs tasks, instead of firing off a "test" 
> tasks and finding out the hard way? Or perhaps, a better solution altogether?
> 
> Thanks,
> jeremy


___

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

Can't create window context…crash

2012-02-22 Thread Gideon King
Hi all, I am seeing quite a number of reports from users of my software where 
on the console, there are errors like the ones below, but I haven't been able 
to reproduce the problem here:

2012-02-21 23:49:05 +0800[3]: kCGErrorIllegalArgument: CGSDeviceCreate: Invalid 
window
2012-02-21 23:49:05 +0800[3]: Failed to create window context device
2012-02-21 23:49:05 +0800[3]: CGWindowContextCreate: failed to create window 
context delegate.
2012-02-21 23:49:05 +0800[4]: _initWithWindowNumber: error creating graphics 
ctxt object for ctxt:0xed23, window:0x0
2012-02-21 23:49:05 +0800[5]: Feb 21 23:49:05 nomato-iMac.local NovaMind5[5658] 
: Failed to create window context device
2012-02-21 23:49:05 +0800[5]: Feb 21 23:49:05 nomato-iMac.local NovaMind5[5658] 
: CGWindowContextCreate: failed to create window context delegate.

Some people are also getting this, which I believe might be related:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x7fff8b05de90 objc_msgSend + 16
1 libobjc.A.dylib 0x7fff8b06303c (anonymous 
namespace)::AutoreleasePoolPage::pop(void*) + 434
2 com.apple.CoreFoundation 0x7fff90efbb05 _CFAutoreleasePoolPop + 37
3 com.apple.AppKit 0x7fff8d567b71 
_handleWindowNeedsDisplayOrLayoutOrUpdateConstraints + 656
4 com.apple.CoreFoundation 0x7fff90f2dbd7 
__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
5 com.apple.CoreFoundation 0x7fff90f2db36 __CFRunLoopDoObservers + 374
6 com.apple.CoreFoundation 0x7fff90f02ce9 __CFRunLoopRun + 825
7 com.apple.CoreFoundation 0x7fff90f02676 CFRunLoopRunSpecific + 230
8 com.apple.HIToolbox 0x7fff9327431f RunCurrentEventLoopInMode + 277
9 com.apple.HIToolbox 0x7fff9327b51b ReceiveNextEventCommon + 181
10 com.apple.HIToolbox 0x7fff9327b456 BlockUntilNextEventMatchingListInMode 
+ 62
11 com.apple.AppKit 0x7fff8d52bf5d _DPSNextEvent + 659
12 com.apple.AppKit 0x7fff8d52b861 -[NSApplication 
nextEventMatchingMask:untilDate:inMode:dequeue:] + 135
13 com.apple.AppKit 0x7fff8d52819d -[NSApplication run] + 470
14 com.omnigroup.OmniAppKit 0x000100515bff -[OAApplication run] + 127
15 com.apple.AppKit 0x7fff8d7a6b88 NSApplicationMain + 867
16 com.novamind.NovaMind5 0x00011bd4 start + 52

Any ideas what to look for to try to get to the root cause of this?

TIA

Gideon



___

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: CGContextSaveGState

2012-02-15 Thread Gideon King
The documentation says it pushes it on to a stack:

"Pushes a copy of the current graphics state onto the graphics state stack for 
the context."

It also says:

"To restore your drawing environment to a previously saved state, you can use 
CGContextRestoreGState."

with the clear implication that you can have multiple of them. And it works in 
practice too… Kind of not sure why the question, since it is clearly stated in 
the documentation...

Regards

Gideon

On 16/02/2012, at 5:22 AM, William Squires wrote:

> Does this method store the context state in a stack, or just store it in a 
> local variable (struct) somewhere (i.e. does calling this more than once 
> overwrite the previously saved context info?)
> 
> 


___

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

iCal syncing on multiple computers

2012-02-13 Thread Gideon King
Hi,

I have some data that is synced with iCal by my application. I get the 
calendars, and the user selects which one to sync to, and in my data, I save 
the UID for the calendar we have synced with.

Now the user moves to a different computer and can't sync, since the same 
calendar is not available on that computer. So I ask them to select another 
calendar to sync with.

BUT, in some cases the calendar on computer 1 is synced with iCloud, and is 
synced to a calendar on the other computer. So in actual fact, the exact same 
calendar with a different UID is available on the other computer.

Is there any way of me knowing that both those calendars are synced with each 
other on iCloud, and therefore effectively the same calendar?

Thanks


Gideon







___

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: copy & isEqual nightmares

2012-02-12 Thread Gideon King

On 13/02/2012, at 11:54 AM, James Maxwell wrote:

> But it does beg the question: is there an easy way to test the **identity** 
> of an object? That is, to NSLog the identity of an object, to see if (and 
> how) it's different to a copy that returns YES to isEqual and has the same 
> hash? I guess I could put something in -description: that would tell me 
> (i.e., include info on the data that I'm NOT comparing in my isEqual 
> method)... Anyway, I was just curious about that. 
> 
> J.
> 

You can 

NSLog(@"%p", self);

to print the address of the object.


Gideon
___

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


NSDateFormatter, timezones and early dates

2012-01-31 Thread Gideon King
I have just come across a really unexpected thing. I have a date formatter like 
so:

NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease];
[formatter setDateFormat:@"-MM-dd'T'HH:mm:ss.SSSZ"];

Now when I use:

[formatter stringFromDate:aDate];

It works fine for dates after 1895, but for dates before that, the string is 
incorrect - around here it should end in +1000, but for dates before 1895, it 
gives +101208.

Is there some way I can get this so that it gives the expected result for all 
dates?

Thanks


Gideon








___

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: willPresentError being called with NSDocumentErrorRecoveryAttempter object

2012-01-16 Thread Gideon King
Ah, I see. OK, I will create my own internal NSError object pointing to nil, 
and if I encounter an error in any of my called methods, I'll create an NSError 
for ti, and if I'm going to return NO, then I'll assign it to the pointer.

Thanks for the quick and helpful response Quincey.

Regards

Gideon

On 17/01/2012, at 12:37 PM, Quincey Morris wrote:

> 
> You're not. 'outError' is an output-only parameter. The value of '*outError' 
> on entry to the method is trash.
> 
> The rule is that if your implementation of 'readFromURL:ofType:error:' is 
> going to return NO, and the 'outError' pointer is not NULL, you *must* create 
> a new NSError object and assign it '*outError'.
> 
> 

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: willPresentError being called with NSDocumentErrorRecoveryAttempter object

2012-01-16 Thread Gideon King
Further information: when the user selects to duplicate, - 
(BOOL)readFromURL:ofType:error: is called with the error argument being an 
NSDocumentErrorRecoveryAttempter object. 

I don't know why this is happening.

Would it be save for me to do something like this:

if (*outError && [*outError 
isKindOfClass:NSClassFromString(@"NSDocumentErrorRecoveryAttempter")]) {
*outError = nil;
}

?

>From a practical perspective, it seems to work, but I just don't get why I'm 
>getting the NSDocumentErrorRecoveryAttempter object passed in to my file 
>reading method.

On 17/01/2012, at 12:07 PM, Gideon King wrote:

> Hi everyone, I'm trying to resolve a very strange problem. In my document I 
> have implemented willPresentError:, and on Lion when someone opens a locked 
> document and tries to edit it, an error is produced, which I forward to 
> super, which gives people the option of unlocking, canceling, or duplicating. 
> 
> If they choose to duplicate, I get another call to willPresentError, but this 
> time the supposed error is not an NSError at all, but instead an 
> NSDocumentErrorRecoveryAttempter object.
> 
> I have no idea how this could happen, and the stack trace doesn't seem to 
> help. Any ideas where to look?
> 
> #0  -[NMPersistentDocument willPresentError:] (self=0x105715850, 
> _cmd=0x7fff8cebd8da, error=0x10d1c5ff0) at 
> /Users/gideon/Development/svn/trunk/mac/Source/NMPersistentDocument.m:598
> #1  0x7fff8c9e6780 in -[NSDocument 
> presentError:modalForWindow:delegate:didPresentSelector:contextInfo:] ()
> #2  0x7fff8c9ed167 in -[NSDocument _presentError:thenContinue:] ()
> #3  0x7fff8ce60171 in __-[NSDocumentErrorRecoveryAttempter 
> attemptRecoveryFromError:optionIndex:delegate:didRecoverSelector:contextInfo:]_block_invoke_3
>  ()
> #4  0x7fff8c9fa6b8 in __-[NSDocument 
> _errorForAutosavingSafetyConcern:userInfo:]_block_invoke_1 ()
> #5  0x7fff8ce5fd3e in -[NSDocumentErrorRecoveryAttempter 
> attemptRecoveryFromError:optionIndex:delegate:didRecoverSelector:contextInfo:]
>  ()
> #6  0x7fff8ce5fdf2 in -[NSDocumentErrorRecoveryAttempter 
> attemptRecoveryFromError:optionIndex:delegate:didRecoverSelector:contextInfo:]
>  ()
> #7  0x7fff8c8eeb6e in __-[NSApplication(NSErrorPresentation) 
> presentError:modalForWindow:delegate:didPresentSelector:contextInfo:]_block_invoke_3
>  ()
> #8  0x7fff8c8f5be4 in -[NSApplication(NSErrorPresentation) 
> _something:wasPresentedWithResult:soContinue:] ()
> #9  0x7fff8c8e5e7d in -[NSAlert didEndAlert:returnCode:contextInfo:] ()
> #10 0x7fff8c8f27d7 in -[NSApplication endSheet:returnCode:] ()
> #11 0x0001006e30d8 in -[OAApplication endSheet:returnCode:] ()
> #12 0x7fff8c8e5d43 in -[NSAlert buttonPressed:] ()
> #13 0x7fff904d3a1d in -[NSObject performSelector:withObject:] ()
> #14 0x7fff8c741710 in -[NSApplication sendAction:to:from:] ()
> #15 0x0001006e3204 in -[OAApplication sendAction:to:from:] ()
> #16 0x7fff8c741642 in -[NSControl sendAction:to:] ()
> #17 0x7fff8c74156d in -[NSCell _sendActionFrom:] ()
> #18 0x7fff8c740a30 in -[NSCell trackMouse:inRect:ofView:untilMouseUp:] ()
> #19 0x7fff8c7c08e0 in -[NSButtonCell 
> trackMouse:inRect:ofView:untilMouseUp:] ()
> #20 0x7fff8c73f63a in -[NSControl mouseDown:] ()
> #21 0x7fff8c70a0e0 in -[NSWindow sendEvent:] ()
> #22 0x7fff8c6a268f in -[NSApplication sendEvent:] ()
> #23 0x0001006dce7f in -[OAApplication sendEvent:] ()
> #24 0x7fff8c638682 in -[NSApplication run] ()
> #25 0x0001006d9bff in -[OAApplication run] ()
> #26 0x7fff8c8b780c in NSApplicationMain ()
> #27 0x00011b82 in main (argc=5, argv=0x7fff5fbffaa8) at 
> /Users/gideon/Development/svn/trunk/mac/Source/main.m:11
> 
> 
> Thanks
> 
> Gideon
> 
> 
> 
> 
> 
> 
> 
> 

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


willPresentError being called with NSDocumentErrorRecoveryAttempter object

2012-01-16 Thread Gideon King
Hi everyone, I'm trying to resolve a very strange problem. In my document I 
have implemented willPresentError:, and on Lion when someone opens a locked 
document and tries to edit it, an error is produced, which I forward to super, 
which gives people the option of unlocking, canceling, or duplicating. 

If they choose to duplicate, I get another call to willPresentError, but this 
time the supposed error is not an NSError at all, but instead an 
NSDocumentErrorRecoveryAttempter object.

I have no idea how this could happen, and the stack trace doesn't seem to help. 
Any ideas where to look?

#0  -[NMPersistentDocument willPresentError:] (self=0x105715850, 
_cmd=0x7fff8cebd8da, error=0x10d1c5ff0) at 
/Users/gideon/Development/svn/trunk/mac/Source/NMPersistentDocument.m:598
#1  0x7fff8c9e6780 in -[NSDocument 
presentError:modalForWindow:delegate:didPresentSelector:contextInfo:] ()
#2  0x7fff8c9ed167 in -[NSDocument _presentError:thenContinue:] ()
#3  0x7fff8ce60171 in __-[NSDocumentErrorRecoveryAttempter 
attemptRecoveryFromError:optionIndex:delegate:didRecoverSelector:contextInfo:]_block_invoke_3
 ()
#4  0x7fff8c9fa6b8 in __-[NSDocument 
_errorForAutosavingSafetyConcern:userInfo:]_block_invoke_1 ()
#5  0x7fff8ce5fd3e in -[NSDocumentErrorRecoveryAttempter 
attemptRecoveryFromError:optionIndex:delegate:didRecoverSelector:contextInfo:] 
()
#6  0x7fff8ce5fdf2 in -[NSDocumentErrorRecoveryAttempter 
attemptRecoveryFromError:optionIndex:delegate:didRecoverSelector:contextInfo:] 
()
#7  0x7fff8c8eeb6e in __-[NSApplication(NSErrorPresentation) 
presentError:modalForWindow:delegate:didPresentSelector:contextInfo:]_block_invoke_3
 ()
#8  0x7fff8c8f5be4 in -[NSApplication(NSErrorPresentation) 
_something:wasPresentedWithResult:soContinue:] ()
#9  0x7fff8c8e5e7d in -[NSAlert didEndAlert:returnCode:contextInfo:] ()
#10 0x7fff8c8f27d7 in -[NSApplication endSheet:returnCode:] ()
#11 0x0001006e30d8 in -[OAApplication endSheet:returnCode:] ()
#12 0x7fff8c8e5d43 in -[NSAlert buttonPressed:] ()
#13 0x7fff904d3a1d in -[NSObject performSelector:withObject:] ()
#14 0x7fff8c741710 in -[NSApplication sendAction:to:from:] ()
#15 0x0001006e3204 in -[OAApplication sendAction:to:from:] ()
#16 0x7fff8c741642 in -[NSControl sendAction:to:] ()
#17 0x7fff8c74156d in -[NSCell _sendActionFrom:] ()
#18 0x7fff8c740a30 in -[NSCell trackMouse:inRect:ofView:untilMouseUp:] ()
#19 0x7fff8c7c08e0 in -[NSButtonCell 
trackMouse:inRect:ofView:untilMouseUp:] ()
#20 0x7fff8c73f63a in -[NSControl mouseDown:] ()
#21 0x7fff8c70a0e0 in -[NSWindow sendEvent:] ()
#22 0x7fff8c6a268f in -[NSApplication sendEvent:] ()
#23 0x0001006dce7f in -[OAApplication sendEvent:] ()
#24 0x7fff8c638682 in -[NSApplication run] ()
#25 0x0001006d9bff in -[OAApplication run] ()
#26 0x7fff8c8b780c in NSApplicationMain ()
#27 0x00011b82 in main (argc=5, argv=0x7fff5fbffaa8) at 
/Users/gideon/Development/svn/trunk/mac/Source/main.m:11


Thanks

Gideon








___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: KVO willChange and didChange

2012-01-15 Thread Gideon King
Cool, thanks everybody. Nice that there is such a simple solution.


Regards

Gideon


On 16/01/2012, at 4:41 PM, Gordon Henriksen wrote:

> Try overriding +[NSObject(NSKeyValueObserving) 
> automaticallyNotifiesObserversForKey:] to return NO for the properties you 
> want to handle manually.
> 

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


KVO willChange and didChange

2012-01-15 Thread Gideon King
Hi all, when I declare a property, something like:

@property(readwrite, copy, nonatomic) NSString *foo;

I will synthesize it with:

@synthesize foo;

But then I want to do some special processing when the value is set, so I 
implement my setter:

- (void)setFoo:(NSString *)aFoo {
[self willChangeValueForKey:@"foo"];
[foo autorelease];
foo = [aFoo retain];
[self didChangeValueForKey:@"foo"];
[self 
doSomeMoreProcessingThatShouldHappenAfterAllTheObserversKnowTheNewValue];
}

I assumed from the documentation and examples that since I was providing my own 
implementation method, that I would have to include the willChange and 
didChange methods at appropriate points in my code, but I have just discovered 
that when I do:

anObject.foo = @"something";

I get two prior notifications - one from the internals of the system, and one 
from my willChange call, and two notifications after the change - one from my 
didChange and one from the system.

So I thought this must because I used @synthesize as well as providing my own 
method, so I implemented a getter and removed the @synthesize. The behavior 
didn't change.

I double checked this by removing my willChange and didChange methods, and now 
the prior and after notifications only got sent once.

One purpose of mentioning this is that given the fact that I have come across 
code from several places where they did what I did and had the willChange and 
didChange code in their setters, others may need to look back at their code and 
make appropriate changes.

But the big thing for me is that I have a number of places throughout my 
application where I need to have the changes made, the didChange notification 
acted on by the observers, and then some other code run.

I therefore wanted to use the setter, but not have to change the name of it, so 
that bindings would still work, so I changed my property declaration to be 
readonly, and declared a setFoo: method. I thought that declaring it would make 
it not call the willChange and didChange behind the scenes, but unfortunately, 
even with a readonly declaration, when I used anObject.foo = @"something", it 
still called the prior and after KVO methods. So I thought I would explicitly 
call setFoo: instead of using dot notation, but that made no difference. On the 
off chance there was something else going on, I also turned off 
accessesInstanceVariablesDirectly, but that made no difference.

So I thought I would just remove the property declarations altogether, and just 
code my accessors myself, but it still called the built in KVO methods. 

Therefore my conclusion is that as soon as you add a KVO observation on 
anything, it triggers the prior and after notifications whenever the setter is 
called. This of course makes sense, but still leaves me with the original 
problem: I need some way to have the KVO notifications called *once only*, and 
yet have my setters able to call other methods after the KVO notifications have 
been sent. It is not possible for this to be done with 
performSelector:withObject:afterDelay: or anything similar, since these methods 
need to be called immediately after the after change notification.

I know I could get it to call the KVO notifications at only the right places by 
coding my own methods like -(void)changeFooTo:, but I do not want to change the 
name of my setters because that would break my bindings. 

Are there any recommendations on the best approach for being able to have the 
setter able to do what it needs with the KVO and then calling other methods, 
without breaking bindings?

I can't believe I have misunderstood this for so long, and never noticed what 
was happening until now!

Thanks

Gideon








___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Forcing autosave

2012-01-12 Thread Gideon King
I have a situation where I need my document's contents on disk, even if it's a 
new document with no changes, so I thought I would just make sure that the 
document had autosaved before I complete my action on the file, and just pick 
up the URL of the last autosave from the document and use that. (I'm running 
this on Lion)


I use:

- 
(void)autosaveWithImplicitCancellability:(BOOL)autosavingIsImplicitlyCancellable
 completionHandler:(void (^)(NSError *errorOrNil))completionHandler

Now this is fine, except that it only works if the user has made at least one 
change to the document.

The documentation says that it invokes the - (BOOL)hasUnautosavedChanges method 
to determine whether to save the document. So I overrode that method so that 
during my operation, it will return YES.

I expected this to ensure that the document would be saved, but it ignores this 
and doesn't autosave it. It does actually call this method during the autosave 
call, but seems to not take notice that I returned YES.

So I tried putting a dummy undo action in just before calling autosave, and 
then undoing it afterwards, just to ensure that the document was dirty. That 
didn't work either. I put it in an undo group, but that didn't work either. I 
forced a checkpoint in the undo manager, but that didn't work either.

So I thought I would try the document updateChangeCount: method, calling 
NSChangeDone before calling autosave, then NSChangeUndone afterwards. That 
worked! I removed all the other stuff and *only* had the updateChangeCount: 
calls in there, and it still autosaved. 

So I have a solution that works, but I'm thinking that my override of 
hasUnautosavedChanges should have forced the autosave. Is this a bug that it 
doesn't?

TIA

Gideon



___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSOpenPanel and finding files

2012-01-01 Thread Gideon King
Thanks for the suggestion Ken. 

The file is found in a Spotlight search, and if I search from within the 
Finder. It is in a folder ~/Temp and is not hidden or otherwise non-indexed.

Regards

Gideon

On 02/01/2012, at 4:58 PM, Ken Thomases wrote:

> On Jan 1, 2012, at 11:52 PM, Gideon King wrote:
> 
>> Hi, I'm trying to use an open panel to open a particular type of file 
>> (.nmcset).
> 
>> [...] the search field at the top of the open panel, I can't seem to find my 
>> files. 
>> 
>> [...] if I type "fred" or "fred.nmcset" or ".nmcset" into the search field, 
>> nothing appears in the results. It does show the options after a few seconds 
>> of what to search for and I say to search for a file name, but it still 
>> doesn't help. Other applications work just fine.
> 
> I doubt this is specific to the open panel.  I suspect you're looking at a 
> folder which is excluded from Spotlight.  Does your file show up with a file 
> search in the Finder?  In the Spotlight menu?
> 
> Check the Spotlight pane of System Preferences, in particular the Privacy 
> tab.  Also, I think there are still some system directories which are 
> excluded from Spotlight by default, although information about that seems 
> scarce or outdated.
> 
> 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


NSOpenPanel and finding files

2012-01-01 Thread Gideon King
Hi, I'm trying to use an open panel to open a particular type of file 
(.nmcset). I create an open panel and run it like this:

NSOpenPanel *openPanel = [NSOpenPanel openPanel];
[openPanel setCanChooseFiles:YES];
[openPanel setCanChooseDirectories:NO];
[openPanel setAllowsMultipleSelection:NO];
[openPanel setTitle:NSLocalizedString(@"Load Color Set", nil)];
[openPanel setAllowedFileTypes:[NSArray arrayWithObjects:@"nmcset", nil]];

if ([openPanel runModal] == NSFileHandlingPanelOKButton) {
…do stuff…
}

All this works fine, and all the files without that extension are disabled, but 
in the search field at the top of the open panel, I can't seem to find my 
files. 

I have a file called "fred.nmcset" in my folder. It appears not grayed out in 
the list, and I can select it and open it just fine.

But, if I type "fred" or "fred.nmcset" or ".nmcset" into the search field, 
nothing appears in the results. It does show the options after a few seconds of 
what to search for and I say to search for a file name, but it still doesn't 
help. Other applications work just fine.

I'm running on 10.7.

Is there something special I need to do to get this to work?


Thanks

Gideon







___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


CGContextDrawTiledImage crash on 10.5

2011-12-02 Thread Gideon King
I'm hoping someone can remember back to 10.5 days…

I am using CGContextDrawTiledImage, and it works absolutely fine on 10.6 and 
10.7, but sometimes crashes on 10.5.

If anyone else has seen this, and worked out what is going on, I'd love to hear.

I can resize the image that I am using to tile with just fine (I had to make 
sure that I was always using integral rects and sizes for this to work on 
10.5), but when I resize my view (changing the frame and bounds for a zoom 
operation), CGContextDrawTiledImage causes a crash. I have tried everything I 
can think of to fix this, ensuring that everything is integral etc, but to no 
avail.

If there is no way around this, is there an equivalent method that I can use in 
Cocoa? Using a color pattern image would seem to get me most of the way there, 
but I haven't been able to figure out how to get the pattern phase setting 
right to be able to emulate what CGContextDrawTiledImage does.


TIA

Gideon



___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Code signature problem

2011-11-29 Thread Gideon King
Hi, I'm having a problem with code signatures. My app has about 20 executables 
in it, all of which I sign using the codesign -f -s command. All of them are 
signed in exactly the same way, and when I run codesign --verify --verbose, it 
says they are all valid.

When I submit the application to the app store, it says that two of the 
signatures are missing or invalid. One is on one of my frameworks and the other 
one is on a .a file.

How can I work out what is going wrong with the signature on these two files, 
given the fact that they pass verification and are signed the same way as the 
ones that are accepted?


Thanks

Gideon



___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Validating dictionary strings file

2011-11-21 Thread Gideon King
I have filed a report on this. The problem originally exhibited itself in a 
strings file that was used for localization, and the error report gave no 
indication which file it was that had the problem, so I included that in the 
bug report too.


Regards

Gideon


On 21/11/2011, at 5:05 PM, Joar Wingfors wrote:

> Please file a bug report. Xcode should generate warnings / errors for strings 
> files, just like it can for other types of files.
> 
>   
> 
> j o a r
> 
> 

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Validating dictionary strings file

2011-11-20 Thread Gideon King
Thanks for the suggestions guys - I have found the issues by a binary search 
process (there were some quotes in the wrong places). I'll keep those ideas in 
my bag of tricks for if I encounter something similar again.

Regards

Gideon

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Validating dictionary strings file

2011-11-20 Thread Gideon King
Thanks for the plutil tip Brian.

It's not supposed to be an old style dictionary - it's just a strings file, and 
I have the whole thing in English and Spanish - the English one loads fine, and 
the Spanish one doesn't. Unfortunately seeing as plutil thinks it's supposed to 
be an old style dictionary file, it just tells me that there is an error at 
line 1.

Maybe I just need to do a binary search for the problem line(s)…


Regards

Gideon

On 21/11/2011, at 4:13 PM, Brian Krent wrote:

> For validation, try "plutil -lint yourFile.plist" in the Terminal. Also, use 
> curly braces for dictionaries in old-style ASCII plists. 
> 

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Validating dictionary strings file

2011-11-20 Thread Gideon King
Hi, I'm trying to use NSDictionary's dictionaryWithContentsOfFile: method and 
am getting an error: CFPropertyListCreateFromXMLData(): Old-style plist parser: 
missing semicolon in dictionary.

The entire file is of the format:

/*some comment */
"Some string" = "Some other string";

Clearly there is some formatting error in the file but it is a rather large 
file and would take a very long time to manually go through and find the issue 
- is there some tool available that will tell me where to look in the file for 
the error?

Thanks

Gideon

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Implementing Full Screen for 10.7 but app should also run on 10.6

2011-11-14 Thread Gideon King
They have not bumped the appkit version number in 10.6 (see NSApplication.h), 
and in previous releases, the number was just bumped by a decimal, so the 
floor() call handles that. As far as I am aware, this comparison should be 
correct.

e.g.
#define NSAppKitVersionNumber10_5 949
#define NSAppKitVersionNumber10_5_2 949.27
#define NSAppKitVersionNumber10_5_3 949.33
#define NSAppKitVersionNumber10_6 1038


Regards

Gideon


On 15/11/2011, at 3:16 AM, Kyle Sluder wrote:

> On Nov 14, 2011, at 7:30 AM, Gideon King  wrote:
> 
>>   if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) {
>> 
> 
> This comparison is incorrect. The AppKit version number almost always gets 
> bumped on an OS point release. This comparison will succeed on 10.6.1 and 
> higher.
> 
> Does Apple not ship symbols for the current AppKit version in the SDK—in 
> other words, is there an NSAppKitVersionNumber10_7 in the 10.7 SDK?
> 
> --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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Implementing Full Screen for 10.7 but app should also run on 10.6

2011-11-14 Thread Gideon King
You could do something like this:


#ifndef NSAppKitVersionNumber10_6
#define NSAppKitVersionNumber10_6 1038
#endif

#ifndef NSWindowCollectionBehaviorFullScreenPrimary
#define NSWindowCollectionBehaviorFullScreenPrimary 1 << 7
#endif


if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) {
[[self window] 
setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
}




HTH

Gideon



On 15/11/2011, at 1:15 AM, Koen van der Drift wrote:

> Another window size question, just putting it ina another thread.
> 
> I'd like my application to use the full screen feature on 10.7, but
> the app should also run on 10.6  I tried adding
> NSWindowCollectionBehaviorFullScreenPrimary for my main window, but
> got an error since I am building agains 10.6 SDK.
> 
> How do I make this work (if possible)?
> 
> 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


App store receipt checking - getting a new receipt

2011-11-12 Thread Gideon King
Hi, I have implemented app store receipt checking, and it all seemed to be 
going OK, but I needed to change the bundle version number and check a new 
version, but when I run the application, it seems to download the previously 
generated receipt from the app store, which of course has the old bundle 
version, so validation fails.

Do I need to do something special to get a new receipt?

I didn't see anything about this in the documentation.

Thanks

Gideon




___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Future for Mac applications

2011-10-31 Thread Gideon King
> 
>> sandboxing clearly hasn't
>> been nailed down yet.
> 
> It's also worth remembering that the Mac App Store is not required either, 
> unlike on iOS devices.  If you can't or don't want to sandbox, you can 
> distribute elsewhere.
> 

Yes, but the App store is a huge publicity opportunity and potentially very 
powerful sales channel, but the way sandboxing is at the moment means that only 
the significantly less capable applications are able to be sandboxed, and 
therefore be available through the app store. So the users only get the cheap 
junk apps on the App store.

Worse for developers, worse for customers, worse for Apple.

I definitely agree that sandboxing has not been nailed down yet. It probably 
requires another generation update before it's ready. I understand what it does 
and why, but at the moment, it's just too restrictive in a number of areas.

Gideon___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Sandbox issues

2011-10-31 Thread Gideon King
Thanks for the reply Kyle. 


On 31/10/2011, at 11:21 AM, Kyle Sluder wrote:

> On Sun, Oct 30, 2011 at 4:46 PM, Gideon King  wrote:
>> Further to my previous questions about sandboxing, I have now done more 
>> research and experimentation, and the more I find out about it the more 
>> questions it throws up.
>> 
>> 1. I have a folder in the Application Support folder that my apps have been 
>> using to store and retrieve log data, but even if I add an entitlement 
>> relative to the home folder to /Library/Application Support/My Folder/ I 
>> still can't access it. I would have expected the sandbox to have a link to 
>> that folder created in the container folder, but it doesn't. I'm interested 
>> in knowing what I may have done wrong with this…
> 
> Read the "Migrating an App to a Sandbox" section of the App Sandbox
> Design Guide: 
> http://developer.apple.com/library/mac/#documentation/Security/Conceptual/AppSandboxDesignGuide/MigratingALegacyApp/MigratingALegacyApp.html#//apple_ref/doc/uid/TP40011183-CH6-SW8
> 

Yes, I understand that, and have migrated the data that is specific to my 
application, but this data is shared between two applications - the main 
application, and the error reporting/crash catcher application. So I don't want 
to migrate it - I want to access it from both applications.

> 
> Do not use NSTemporaryDirectory. Use -[NSFileManager
> URLForDirectory:inDomains:].

I can't see one that relates to the temporary folder - I had a look at all the 
available values for NSSearchPathDirectory.

> LSOpenFromURLSpec is prohibited under sandboxing.
> 
> This is prohibited under sandboxing. Read "Accessing Preferences of
> Other Apps" in the App Sandbox Design Guide:
> http://developer.apple.com/library/mac/documentation/Security/Conceptual/AppSandboxDesignGuide/DesigningYourSandbox/DesigningYourSandbox.html#//apple_ref/doc/uid/TP40011183-CH4-SW12
> 
> File Radars describing your issues with App Sandboxing, and visit the
> Application Sandboxing Dev Forums:
> https://devforums.apple.com/community/mac/lion/appsandbox
> 
> --Kyle Sluder

I'll submit reports on the issues, but my conclusion at this stage is that it 
will be completely impossible for me to use the sandboxing system in its 
current implementation. I see on the developer forum that there are a number of 
other people expressing similar concerns.

It is not clear to me where Apple is going with this as far as when 
Applications are going to require to be sandbox compliant (they do say in one 
place that it will be November, but there seem to have been so many issues 
raised since then that I wonder whether that really will be enforced), or what 
happens if it is just not possible for a specific application to work with the 
sandbox. Will there be some way for applications to get approval even if it 
doesn't work with the sandbox? Is Apple going to update the sandbox to allow 
for these types of scenarios? We just don't know at this stage…

I'll see how far I can get with the forums and bug reports, but for the moment, 
this appears to stall my app store submission process.

Regards

Gideon___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Write to file Entitlement

2011-10-30 Thread Gideon King
If you are writing to somewhere inside the sandbox, you can read and write 
freely, but if outside, then you have to go through the save panel, which 
behind the scenes stretches your sandbox to include that file.

Regards

Gideon



On 31/10/2011, at 3:27 PM, James Merkel wrote:

> Reading the sandboxing documents, it looks like in order to write to a file 
> you need to use the save dialog.
> My app updates files without the save dialog.
> Will that be permitted in a sandboxed app ?
> 
> Jim Merkel
> ___
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/gideon%40novamind.com
> 
> This email sent to gid...@novamind.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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Sandbox issues

2011-10-30 Thread Gideon King
Further to my previous questions about sandboxing, I have now done more 
research and experimentation, and the more I find out about it the more 
questions it throws up.

1. I have a folder in the Application Support folder that my apps have been 
using to store and retrieve log data, but even if I add an entitlement relative 
to the home folder to /Library/Application Support/My Folder/ I still can't 
access it. I would have expected the sandbox to have a link to that folder 
created in the container folder, but it doesn't. I'm interested in knowing what 
I may have done wrong with this…

2. My application allows users to drag files on to the documents to create 
links to those files, and when they click the links, it uses NSWorkspace to 
open the files, which initially works, but then when the user restarts the 
application, and tries to open the file, it says that I don't have permission 
to view it. I think this is a fundamental limitation of the sandbox, and 
believe that there is no workaround for this. I would love to be proved wrong 
on this.

3.  In my application, you can embed files as part of the file that is saved, 
and when you want to open the embedded file, it copies it to a temporary folder 
(using NSTemporaryDirectory() ), and uses NSWorkspace to open the file. This is 
being denied by the sandbox with a message "deny file-issue-extension", and 
"Quarantine resolution refused". So this gets blocked too… Is there some way 
around this?

4. When I try to launch my error reporting application from my main 
application, I get an error LSOpenFromURLSpec() returned -10827. Again, this 
only happens when using sandboxing - any clues?

5. I use CFPreferencesCopyAppValue to read information about the user's iPhoto 
preferences (so that I know where to look to load their iPhoto library), but 
this doesn't seem to work in the sandbox either - is there a workaround for 
this?


All of these issues are show stoppers for me being able to use the sandbox, and 
with Apple declaring that all apps submitted to the app store must be 
sandboxed, this becomes a major issue. If any of these is not able to be 
resolved, then I will not be able to submit my app to the app store. If these 
issues are not resolved, I can think of quite a number of productivity 
applications that won't be able to be sandboxed for these same reasons.


Any assistance with any of these issues will be greatly appreciated.


Gideon







___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Sandboxing question

2011-10-28 Thread Gideon King
Hi All

I have an application that I am just moving to using sandboxing, and it 
currently (before sandboxing) writes log files to a folder in the Application 
Support folder, then if the program crashes, or the user wants to submit a 
defect report, it launches another application that picks up the log files and 
includes them in the report that is sent to our development team.

I am planning to have both the main application and the defect reporting 
application sandboxed, but am wondering what the best approach is for the log 
files that are written by one application and read by the other.

If I migrate the log folder from the Application Support folder to either of my 
other containers, it will not be accessible to the other application. I 
therefore think I need a file access temporary exception set up in both 
applications - would this be the best approach?

If so, I will need to have it relative to the Application Support folder, but 
the only settings available are relative to the user's home folder, and I'm 
worried about hard coding a reference to /Library/Application Support in case 
there are localization issues - is this something I need to worry about? Is it 
always ~/Library/Application Support on all systems in all languages?

Thanks

Gideon




___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Core Data: Determine if managed object is deleted

2011-10-20 Thread Gideon King
Ooh, I had never noticed that - I just assumed that the method did what you 
would think. That may be the cause of an issue in my code. Thanks for the heads 
up.

I would tend to try to avoid processPendingChanges if possible since it appears 
to be a rather expensive operation.

Regards

Gideon

On 21/10/2011, at 8:37 AM, Jerry Krinock wrote:

> When I need to know whether or not a managed object is deleted, often I fall 
> into the trap of trying -[NSManagedObject isDeleted], forgetting that its 
> documentation states …
> 
>  "… It may return NO at other times, particularly after the object has been 
> deleted. …"
> 
> In other words, they should have named that method -isDeletedForSure, to 
> indicate that the NO result is not reliable.
> 
> Anyhow, today I fixed a problem by using this instead …
> 
>   BOOL isDeleted ;
>   isDeleted = [object isDeleted] || ([object managedObjectContext] == nil) ;
> 
> I'm not sure if it will work in all situations.  I suppose that sending the 
> magical -processPendingChanges would be another workaround.
> 

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Code signing issues

2011-10-19 Thread Gideon King
I had not, but now I have - it made no difference - I still got the same 
cryptic error message.

Regards

Gideon

On 18/10/2011, at 11:29 AM, Graham Cox wrote:

> 
> On 18/10/2011, at 12:27 PM, Gideon King wrote:
> 
>> • The system interprets the exit status and attempts to obtain a valid 
>> receipt. Assuming your application signing certificate is valid, the system 
>> installs a valid receipt for the application. The system may prompt you for 
>> your iTunes credentials.
> 
> 
> So have you added your app to your iTunes Connect account?
> 
> --Graham
> 
> 

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Code signing issues

2011-10-17 Thread Gideon King
On 18/10/2011, at 11:16 AM, Graham Cox wrote:

> 
> However, checking apps I build with Xcode versus those I have downloaded from 
> the App Store shows that indeed, my dev apps do not have a receipt. Why would 
> they, I didn't "receive" them, I made them.
> 
> Maybe there's a method for obtaining or generating a receipt for testing the 
> verification mechanism, or perhaps you just have to trust that by the time an 
> app has gone up on the Store, that part will work (you'd have to be very 
> brave or foolish to do that I think). Maybe you should ask about that on the 
> relevant forum at Mac Dev?
> 
> --Graham
> 
> 

It's built in to the system - from the docs:

In order to test your main application during the development process, you need 
a valid receipt so that your application launches. To set this up, do the 
following:

• Make sure you have Internet access so you can connect to Apple’s 
servers.
• Launch your application by double-clicking on it (or in some way 
cause Launch Services to launch it).

After you launch your application, the following occurs:

• Your application fails to validate its receipt because there is no 
receipt present, and it exits with a status of 173.
• The system interprets the exit status and attempts to obtain a valid 
receipt. Assuming your application signing certificate is valid, the system 
installs a valid receipt for the application. The system may prompt you for 
your iTunes credentials.
• The system relaunches your application, and your application 
successfully validates the receipt.

With this development receipt installed, you can launch your application by any 
method—for example, with gdb or the Xcode 
debugger.___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Code signing issues

2011-10-17 Thread Gideon King
On 18/10/2011, at 10:40 AM, Graham Cox wrote:
> 
> To actually submit an app to the App Store, it needs to be made into a signed 
> installer package. The Organizer performs this packaging and signing task.
> 
> For running in the Finder for testing, you don't need to bother with it. 
> However, in my case I have not added code for verifying the receipt, so I've 
> not run into the issue you have.
> 
> Perhaps your verification code is using the wrong certificate? Once you 
> return 173 to the Finder, presumably that will act as if the whole thing came 
> from the App Store, so may be looking for certain things to be in place, such 
> as a signed installer receipt, etc, which of course you don't have, as you 
> haven't built a signed installer. But that shouldn't matter - your code which 
> checks the app receipt doesn't require that, so it should not be erroneously 
> returning 173 in the first place. What you have shown is that if the 
> verification fails, the Finder will attempt to resolve it, it's just that you 
> don't have the pieces in place to allow it to do that. That's OK, by the time 
> your app is reviewed and available on the App Store, it will be correct by 
> definition and so that will work on a users machine. What you need to do is 
> ensure that the receipt verification you have succeeds!

It can't be that the verification code is using the wrong cert, because the 
receipt checking exits immediately it doesn't find a receipt in the app 
wrapper, and the system takes over from there to try to get a testing receipt 
from the app store, and it never succeeds in doing that, either because it says 
my app is not signed (if I signed using the Mac Developer cert, or with the 
test account/sandbox error if I signed using the 3rd party application cert. It 
never gets to the point where it's actually validating a receipt within my app. 
There's definitely some piece of the puzzle missing, but I don't know what...

Thanks for the info on the update mechanism and receipts - thought it must work 
something like that, but there didn't seem to be anything about it in the 
documentation.

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Code signing issues

2011-10-17 Thread Gideon King
For Mac development, it appears you need a "Mac Developer" cert, a "3rd Party 
Mac Developer Installer" cert, and a "3rd Party Mac Developer Application" 
cert. I have these in my keychain, however only "3rd Party Mac Developer 
Application" shows up in Xcode. I can understand that the installer one doesn't 
since it would be used only to sign the installer in the archive operation, but 
I thought the "Mac Developer" one was supposed to show up for use when doing 
development builds.

Regards

Gideon

On 18/10/2011, at 10:35 AM, Philip Vallone wrote:

> Hi,
> 
> I develop for the iphone, but If the process is the same for a Mac App, you 
> should have 2 certificates in Key chain
> 
> 1. Mac Developer
> 2. Mac Distribution
> 
> 

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Code signing issues

2011-10-17 Thread Gideon King
Thanks for the reply Graham. I'm using Xcode 4.2. Please see comments inline



On 18/10/2011, at 9:55 AM, Graham Cox wrote:

> On 18/10/2011, at 10:34 AM, Gideon King wrote:
> 
>> So I have the following questions:
>> 
>> 1. When creating the certificates, 3 certs are created and added to the 
>> keychain - should I be able to see all three of them in Xcode? If so, what 
>> do I need to do to get them to show up there?
> 
> In the build settings, only one cert shows up, '3rd Party Mac Developer 
> Application'. You can choose 'Other…' and type one in, but I have never 
> needed to do this.

OK, not sure why have three certs if only one ever shows up, but if always 
using the '3rd Party Mac Developer Application' for all your builds works for 
you, I'll try the same.
> 
> 
>> 2. When I do a build using my "Mac Developer" cert, it doesn't give any 
>> errors when signing, but the Store seems to think that the app is not 
>> signed. What do I do about this?
> 
> At what stage does the Store "think" it isn't signed? I do "Archive" (in 
> Xcode 3.x this was "Build & Archive"), then in the Organiser I click 
> 'Validate'. The Organizer should package the app and sign the package using 
> the '3rd Party Mac Developer Installer' cert. If you click 'Share' you can 
> see this cert in the 'Identity' pop-up. Using this, you can create the signed 
> package on disk and test the installation without having to attempt a 
> submission to the Store.

I haven't got my head around the whole archive thing yet (or the Organizer for 
that matter). Perhaps this is something I need to look into next - I started 
looking at the documentation before but just got confused as to the purpose of 
the organizer and the build and archive options. I have just been building 
using Command+R and running the app from the Finder. So when I do that, the 
first time it tries to run, it finds that there is no receipt, and launch 
services (or whatever it is that handles this behind the scenes) must ask the 
store for a receipt, but it says it can't do so because the app is not signed.

> 
>> 3. When I sign with my "3rd Party Mac Developer Application", I get the 
>> message about it not being a test user account, and to create an account in 
>> the sandbox. Is this something I need to do in the App store, in my 
>> development settings, a different Apple ID, or on my computer?
> 
> 
> I have no idea about this, sorry. Never seen it myself.
> 
> Sounds like you might not have the installer certificate set up - it's 
> separate and different from the app cert. You also need the WWDC cert, I'm 
> not sure exactly where that comes into play, it needs to be in the keychain 
> but it's never directly used at any step of the deployment procedure.

Yes, I have an installer cert, and have just installed the WWDR cert, but that 
didn't seem to make any difference.

Also, I'm worried about the CFBundleShortVersionString that is used for 
validation of the receipt. As every update will have a different version 
string, but the receipt will presumably have been created for the version that 
the user initially purchased, will this still work? Will they get an updated 
receipt when they download a new version of the app from the store? 

Thanks again

Gideon

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Code signing issues

2011-10-17 Thread Gideon King
Hi, I'm trying to build App store receipt verification into my app.

I went through the certificate setup process and believe I have all three keys 
and certificates successfully installed in my keychain. I then went into my 
build settings for my project to set the code signing identity. I assumed that 
the values there should match my Mac Developer setting in the debug build and 
the 3rd Party Mac Developer Application for release. This seems to be kind of 
implied in their naming and descriptions in the developer area, but I haven't 
seen any specific documentation to confirm this. Since neither of those exact 
settings were showing in the list to select from, I typed them in, and built it.

The code signing appears to work - certainly there are no errors, but then I 
tried to run the application (signed with the Mac Developer cert) from the 
Finder. It first exits with code 173 due to their being no receipt (as 
expected), and then the system obviously goes to try to get the receipt, and I 
get a console message:

store agent: Unsigned app (my application)

So I thought I would try using the only identity listed in Xcode: "3rd Party 
Mac Developer Application", and again the build appeared to work (I did read 
somewhere that the cert selection just works on a prefix match), but this time, 
it first exits with code 173 as expected, and then asks me to log in to the app 
store, which I do with my development apple id, and it says "This is not a Test 
User account. Please create a new account in the Sandbox environment". I have 
no idea what that message means for me to do.

So I have the following questions:

1. When creating the certificates, 3 certs are created and added to the 
keychain - should I be able to see all three of them in Xcode? If so, what do I 
need to do to get them to show up there?

2. When I do a build using my "Mac Developer" cert, it doesn't give any errors 
when signing, but the Store seems to think that the app is not signed. What do 
I do about this?

3. When I sign with my "3rd Party Mac Developer Application", I get the message 
about it not being a test user account, and to create an account in the 
sandbox. Is this something I need to do in the App store, in my development 
settings, a different Apple ID, or on my computer?

I'm finding it really hard to get all this working due to the lack of clear 
documentation and most of the previous Q&As having been about the iTunes 
requirements which seem to be different. 

Any help to resolve these issues would be very much appreciated.


Regards

Gideon








___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Possible causes of "attempted layout while textStorage is editing"?

2011-09-01 Thread Gideon King
Hmmm, I see that there is a place in my code where they can be editing the text 
view, and then they mouse down in its containing view, and that triggers an 
event to be posted through NSApp at the end of the event queue and an 
autorelease being sent to the enclosing view which would eventually result in 
the text view being removed, while that event could trigger a 
glyphRangeForTextContainer call. I guess that might leave things open to the 
possibility of something still being edited when I am working with the text. 

I think I'll try using ensureLayoutForTextContainer: and then removing the text 
view from its superview, so nothing else can possibly happen to the text after 
that (I hope...)

Thanks for your help with this Jonathan.

Gideon




On 01/09/2011, at 8:52 PM, jonat...@mugginsoft.com wrote:

> 
> 
> Is it possible that the user is editing the textview when this code is 
> triggered?
> From the looks of the trace you react directly to the mouseDown event in 
> another view which might not give NSTextView opportunity to conclude its edit.
> I would schedule my layout manipulation on the runloop and see if that  helps.
> 
> Regards
> 
> Jonathan
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Possible causes of "attempted layout while textStorage is editing"?

2011-08-31 Thread Gideon King
Here is the complete stack trace

2011-08-31 15:25:11 -0400[5]: ERROR - 14764064ms (NMApplication.m:81) 
-[NMApplication handleRunException:] - NSException Exception encountered: 
-[AAMainEditingLayoutManager 
_fillLayoutHoleForCharacterRange:desiredNumberOfLines:isSoft:] *** attempted 
layout while textStorage is editing. It is not valid to cause the layoutManager 
to do layout while the textStorage is editing (ie the textStorage has been sent 
a beginEditing message without a matching endEditing.)

2011-08-31 15:25:11 -0400[5]: 0 CoreFoundation 0x7fff8b3e0986 
__exceptionPreprocess + 198
2011-08-31 15:25:11 -0400[5]: 1 libobjc.A.dylib 0x7fff8bb11d5e 
objc_exception_throw + 43
2011-08-31 15:25:11 -0400[5]: 2 CoreFoundation 0x7fff8b3e07ba +[NSException 
raise:format:arguments:] + 106
2011-08-31 15:25:11 -0400[5]: 3 CoreFoundation 0x7fff8b3e0744 +[NSException 
raise:format:] + 116
2011-08-31 15:25:11 -0400[5]: 4 AppKit 0x7fff89f1d0bc 
-[NSLayoutManager(NSPrivate) 
_fillLayoutHoleForCharacterRange:desiredNumberOfLines:isSoft:] + 432
2011-08-31 15:25:11 -0400[5]: 5 AppKit 0x7fff89f1ccce 
-[NSLayoutManager(NSPrivate) _fillLayoutHoleAtIndex:desiredNumberOfLines:] + 203
2011-08-31 15:25:11 -0400[5]: 6 AppKit 0x7fff89f1af46 
_NSFastFillAllLayoutHolesUpToEndOfContainerForGlyphIndex + 500
2011-08-31 15:25:11 -0400[5]: 7 AppKit 0x7fff89f1ac5e -[NSLayoutManager 
textContainerForGlyphAtIndex:effectiveRange:] + 223
2011-08-31 15:25:11 -0400[5]: 8 AppKit 0x7fff89f1aa42 -[NSLayoutManager 
glyphRangeForTextContainer:] + 304
2011-08-31 15:25:11 -0400[5]: 9 NovaMind5 0x00010014453c -[AARichTextModel 
recalculateSize] + 1640
2011-08-31 15:25:11 -0400[5]: 10 NMFoundation 0x000100476f2f 
-[MAKVObservation observeValueForKeyPath:ofObject:change:context:] + 122
2011-08-31 15:25:11 -0400[5]: 11 Foundation 0x7fff8b83118a 
NSKeyValueNotifyObserver + 387
2011-08-31 15:25:11 -0400[5]: 12 Foundation 0x7fff8b852387 
NSKeyValueDidChange + 486
2011-08-31 15:25:11 -0400[5]: 13 Foundation 0x7fff8b7fea2f 
-[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:] + 130
2011-08-31 15:25:11 -0400[5]: 14 CoreData 0x7fff8f7e7007 
_PF_ManagedObject_DidChangeValueForKeyIndex + 103
2011-08-31 15:25:11 -0400[5]: 15 CoreData 0x7fff8f7e6558 
_sharedIMPL_setvfk_core + 264
2011-08-31 15:25:11 -0400[5]: 16 NovaMind5 0x00010016118e 
-[AATopicShapeModelBase setNewWidthForMainRect:fromOldWidth:] + 2657
2011-08-31 15:25:11 -0400[5]: 17 NovaMind5 0x0001001606b4 
-[AATopicShapeModelBase setNewSizeForMainRect:fromOldSize:] + 130
2011-08-31 15:25:11 -0400[5]: 18 NovaMind5 0x0001001882e2 
-[AAMapView(mouse) resizeTopicNodeVisual:usingHandle:withEvent:] + 2287
2011-08-31 15:25:11 -0400[5]: 19 NovaMind5 0x000100187721 
-[AAMapView(mouse) mouseDown:] + 5283
2011-08-31 15:25:11 -0400[5]: 20 AppKit 0x7fff89f4066e -[NSWindow 
sendEvent:] + 6280
2011-08-31 15:25:11 -0400[5]: 21 AppKit 0x7fff89ed8f19 -[NSApplication 
sendEvent:] + 5665
2011-08-31 15:25:11 -0400[5]: 22 OmniAppKit 0x000100574900 -[OAApplication 
sendEvent:] + 144
2011-08-31 15:25:11 -0400[5]: 23 AppKit 0x7fff89e6f42b -[NSApplication run] 
+ 548
2011-08-31 15:25:11 -0400[5]: 24 OmniAppKit 0x000100571774 -[OAApplication 
run] + 132
2011-08-31 15:25:11 -0400[5]: 25 AppKit 0x7fff8a0ed52a NSApplicationMain + 
867
2011-08-31 15:25:11 -0400[5]: 26 NovaMind5 0x00011688 start + 52
2011-08-31 15:25:11 -0400[5]: 27 ??? 0x0002 0x0 + 2


There are no other console log messages before this.

Regards

Gideon








On 01/09/2011, at 8:02 AM, Martin Wierschin wrote:

>> _fillLayoutHoleForChar acterRange:desiredNumberOfLines:isSoft: *** attempted 
>> layout while textStorage is editing. It is not valid to cause the 
>> layoutManager to do layout while the textStorage is editing (ie the 
>> textStorage has been sent a beginEditing message without a matching 
>> endEditing.)
> 
> ...
>> I have not called begin editing or end editing at all, and there are no 
>> unmatched begin and end editing calls in my code, and there are no other 
>> threads editing the text storage. Nothing that I can see that would trigger 
>> this.
> 
> That might be, but perhaps the begin/end editing calls are made for you 
> automatically as part of some bigger operation your code (or the user) 
> requested. For example, it might be that Apple's implementation of 
> -[NSTextView changeFont:] wraps its changes in begin/end editing.
> 
>> The offending line of code is:
>> 
>> [layoutManager glyphRangeForTextContainer:[[layoutManager textContainers] 
>> firstObject]];
> 
> 
> When are you requesting this layout exactly? Can you post the full backtrace 
> for the exception?
> 
> I'd ask the user to submit a recent console log to see if there have been any 
> other errors. It could be that an earlier exception is unwinding the stack 
> during text storage editing, leaving the storage in its invalid state. You 
> might also m

Possible causes of "attempted layout while textStorage is editing"?

2011-08-30 Thread Gideon King
I am receiving occasional reports from customers who are seeing this error:

_fillLayoutHoleForChar acterRange:desiredNumberOfLines:isSoft: *** attempted 
layout while textStorage is editing. It is not valid to cause the layoutManager 
to do layout while the textStorage is editing (ie the textStorage has been sent 
a beginEditing message without a matching endEditing.)

0 CoreFoundation 0x7fff822847b4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x7fff883dbf03 objc_exception_throw + 45
2 CoreFoundation 0x7fff822845d7 +[NSException raise:format:arguments:] + 103
3 CoreFoundation 0x7fff82284564 +[NSException raise:format:] + 148
4 AppKit 0x7fff8192ce00 -[NSLayoutManager(NSPrivate) 
_fillLayoutHoleForCharacterRange:desiredNumberOfLines:isSoft:] + 643
5 AppKit 0x7fff8192c9b0 -[NSLayoutManager(NSPrivate) 
_fillLayoutHoleAtIndex:desiredNumberOfLines:] + 211
6 AppKit 0x7fff8192b62f 
_NSFastFillAllLayoutHolesUpToEndOfContainerForGlyphIndex + 679
7 AppKit 0x7fff8192b1a5 -[NSLayoutManager 
textContainerForGlyphAtIndex:effectiveRange:] + 243
8 AppKit 0x7fff81840c12 -[NSLayoutManager glyphRangeForTextContainer:] + 286

The offending line of code is:

[layoutManager glyphRangeForTextContainer:[[layoutManager textContainers] 
firstObject]];

(with the intention of causing layout so I can get the usedRectForTextContainer)

...but during this method, the only thing I have done is set the text container 
size to a user defined width (never less than 10) and a height of 1.0e7, and 
then called the glyphRangeForTextContainer method.

I have not called begin editing or end editing at all, and there are no 
unmatched begin and end editing calls in my code, and there are no other 
threads editing the text storage. Nothing that I can see that would trigger 
this.

I have not been able to reproduce the problem here.

I'd be interested in any suggestions of things to look for which may be 
triggering this error.

Thanks


Gideon





___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Exception getting shared font panel

2011-08-22 Thread Gideon King
Thanks, Peter. How did you work out which was corrupted? Was it just a matter 
of elimination? Binary search?

On 22/08/2011, at 11:02 PM, P Teeson wrote:

> 
> Does your user have a corrupted Font?
> I had something somewhat similar with FreeSans.ttf and LibreOffice.
> Took a while to track down which one it was.
> 
> Peter

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Exception getting shared font panel

2011-08-22 Thread Gideon King
I've had a report from a user of the following segv exception on 10.7.1:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.apple.CoreText 0x7fff94955f89 
_ZL39CTFontDescriptorsCopyAttributesInternalPK9__CFArrayPK7__CFSetjb + 270
1 com.apple.CoreText 0x7fff94955e5a CTFontDescriptorsCopyAttribute + 71
2 com.apple.CoreText 0x7fff94955a9b 
TCollection::CopyFontAttribute(__CFString const*, unsigned int) const + 41
3 com.apple.AppKit 0x7fff8c77c365 -[NSFontManager 
_availableFontFamiliesForCollectionName:] + 105
4 com.apple.AppKit 0x7fff8c77a20e -[NSFontManager 
_familyNamesForCollection:] + 46
5 com.apple.AppKit 0x7fff8c774a06 -[NSFontPanel numberOfRowsInTableView:] + 
112
6 com.apple.AppKit 0x7fff8c6600eb -[NSTableView _uncachedNumberOfRows] + 125
7 com.apple.AppKit 0x7fff8c5faa8f -[_NSTableRowHeightStorage numberOfRows] 
+ 63
8 com.apple.AppKit 0x7fff8c5faa4e -[NSTableView numberOfRows] + 40
9 com.apple.AppKit 0x7fff8c661ce3 -[NSTableView _verifySelectionIsOK] + 135
10 com.apple.AppKit 0x7fff8c661913 -[NSTableView _tileAndRedisplayAll] + 358
11 com.omnigroup.OmniAppKit 0x00010058fea4 
-[NSTableView(OAColumnConfigurationExtensions) 
_configurableColumnReplacementReloadData] + 20
12 com.apple.AppKit 0x7fff8c77bad0 -[NSFontPanel _chooseCollection:] + 1087
13 com.apple.AppKit 0x7fff8c77769a -[NSFontPanel _setup] + 1650
14 com.apple.AppKit 0x7fff8c76fbee -[NSFontPanel 
initWithContentRect:styleMask:backing:defer:] + 765
15 com.apple.AppKit 0x7fff8c76f8ea -[NSPanel init] + 99
16 com.apple.AppKit 0x7fff8c76f76f +[NSFontPanel sharedFontPanel] + 87

Any ideas what could cause this, or whether there is anything I can do to avoid 
the issue? It seems to be very rare, but any crash makes my software look bad...



Thanks

Gideon






___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: recomendations for creating a beta with date to expire

2011-08-14 Thread Gideon King
I agree, and would like to add that I have done this, and did encounter an 
issue where people had an expired beta and therefore couldn't use the program 
until they had downloaded an update, and were annoyed by that - especially if 
they were on the road and had no internet connection. Although I explained to 
them the benefits to all parties of them running the latest beta, it was still 
an issue.

So if you're going to be doing an extended beta program, you might like to 
think about either having an expiry date that is always far enough in the 
future so that people who download a beta are never in a situation where they 
would have to download another version in just a few days time. And for the 
internet issue, maybe you could have something that would allow them to use the 
beta beyond the expiry for a couple of weeks if they don't have an internet 
connection, but require them to download the next beta, or release version if 
they have an internet connection.

Obviously it depends on your exact situation, but I thought it worthwhile to 
mention my experiences of doing this sort of thing in case it is of some use to 
you.

Regards

Gideon

On 15/08/2011, at 8:44 AM, Nick Zitzmann wrote:

> I would just use the system clock. Most people aren't going to change their 
> clock to run something that's time-limited that has expired, especially if 
> that would interfere with other applications, and the people who will do that 
> probably won't buy the final product anyway. And requiring a network 
> connection to run software that normally doesn't need a network connection, 
> such as your proposal, is a major inconvenience for a lot of people.
> 
> Restrictive DRM inconveniences people, and really restrictive DRM drives 
> people to piracy if the pirated edition is more convenient to use than the 
> legit version.

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Save panel exception: "parentForItemsInColumn: is not supported for browsers with matrix delegates"

2011-08-14 Thread Gideon King
Hi, I have the following code to run a save panel:

NSSavePanel *sp = [NSSavePanel savePanel];
[sp setExtensionHidden:NO];

[sp setTitle:NSLocalizedString(@"Export image to PNG file", @"")];
[sp setRequiredFileType:@"png"];
[sp setAccessoryView:bitmapAccessoryView];
[sp beginSheetModalForWindow:[document windowForSheet] 
completionHandler:^(NSInteger result) {
if (result == NSOKButton) {
[self exportBitmapToFile:[[sp URL] path] 
usingBitmapImageType:NSPNGFileType];
}
[self cleanupFromExportOfType:exportType];
}];

When running on Lion, some users are getting the following exception: 
parentForItemsInColumn: is not supported for browsers with matrix delegates

The trace is as follows:

0 CoreFoundation 0x7fff8608c986 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x7fff8581ed5e objc_exception_throw + 43
2 AppKit 0x7fff8b854ecd -[NSBrowser itemAtIndexPath:] + 0
3 FinderKit 0x7fff89456843 -[FI_TColumnView addColumn] + 110
4 AppKit 0x7fff8b83c665 -[NSBrowser loadColumnZero] + 103
5 FinderKit 0x7fff89459f5b -[FI_TColumnViewController openTarget] + 1228
6 FinderKit 0x7fff89498db7 -[FIFinderViewGutsController 
commonFinishInitialization] + 103
7 FinderKit 0x7fff89495629 -[FIFinderViewGutsController buildBrowserView:] 
+ 167
8 FinderKit 0x7fff89495af1 -[FIFinderViewGutsController 
setTargetPath:withViewStyle:] + 635
9 FinderKit 0x7fff894964a4 -[FIFinderViewGutsController setViewStyle:] + 439
10 Foundation 0x7fff8a794706 _NSSetObjectValueAndNotify + 261
11 FinderKit 0x7fff8949b5b9 -[FIFinderView setViewStyle:] + 253
12 AppKit 0x7fff8ba893ae -[NSSavePanel 
beginSheetModalForWindow:completionHandler:] + 56
13 NovaMind5 0x000100098f80 -[NMExporter exportDocument:toFileOfType:] + 
6080


I am unable to reproduce the problem here, but have had the problem reported by 
several people running Lion. 

Is there something I am doing wrong in my code? Could this be a Lion bug?


Thanks


Gideon

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: A trap with full screen in Lion

2011-07-29 Thread Gideon King
Thanks for that suggestion Martin - I hadn't thought of looking at parent 
window. I kind of think that is an implementation detail behind the scenes that 
we shouldn't have to worry about in our code, so will file a bug report about 
it as Corbin suggested, and hopefully it will either be made to return the same 
window controller as if the window hadn't been swapped out from under you, or 
the documentation changed to make it very clear of the existence of this issue 
(to me, the former solution would seem by far the best one).

Regards

Gideon


On 30/07/2011, at 9:44 AM, Martin Wierschin wrote:

>> I just came across a bit of an issue with the full screen mode in Lion: if 
>> you have a view and use [[self window] windowController] to get at your 
>> window controller, it will return nil in full screen mode. The window gets 
>> swapped out with an NSToolbarFullScreenWindow, which doesn't have a window 
>> controller set.
> 
> Thanks for letting us know about this potential issue.
> 
>> I have found that [[NSApp mainWindow] windowController] returns the right 
>> thing, which is sufficient for my needs
> 
> It looks like you can also get to the proper window controller via: 
> [[[toolbarItemView window] parentWindow] windowController], which seems like 
> a safer solution.
> 
> Best,
> ~Martin
> 

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: What could cause a fast enumeration mutation error in updating tracking areas?

2011-07-29 Thread Gideon King
Thanks for the suggestion Raleigh, but no, there are no other threads involved 
in any of the tracking area code, and looking at the crash report in more 
detail, it shows that the array that is being mutated has 27 items in it - the 
views I create only have one or two tracking areas that I add. I do have quite 
a few tracking rects but can't find a place where I would have 27 of them on a 
view.

I went through all my code looking for where I was using tooltips, and I found 
one suspicious looking bit of code, where in certain circumstances my drawRect: 
could call a method which would lead to removeAllTooltips and 
addToolTipRect:owner:userData: to be called. Seeing as this looks like the most 
likely cause (assuming the implementation uses tracking areas behind the 
scenes), and it's probably not a good thing to be doing during drawRect, I'll 
shift the code to be called outside drawRect: and see if the error goes away.

There are a few other places where tooltip rects could be updated and there 
could be 27 of them, but although in some cases the initiating caller may have 
come from another thread, it always calls back to the main thread for this 
operation, so I'm pretty sure we're OK there.

I also thought that cursor rects may be using tracking areas behind the scenes, 
so checked them too, but they are all done through the resetCursorRects 
mechanism, so presumably that would only be called when it is safe to do so.

So maybe the drawRect: one was it - I guess I'll know in a few days when I roll 
it out to my testers and see if I get the error again.

Regards

Gideon


On 30/07/2011, at 2:14 AM, Raleigh Ledet wrote:

> Do you have another thread that is doing something with tracking areas?
> 
> -raleigh
> 
> On Jul 28, 2011, at 11:33 PM, Gideon King wrote:
> 
>> Hi, I have a problem where a few users of my program are getting the 
>> following exception:
>> 
>> 0 CoreFoundation 0x7fff862df7b4 __exceptionPreprocess + 180
>> 1 libobjc.A.dylib 0x7fff84b0ff03 objc_exception_throw + 45
>> 2 CoreFoundation 0x7fff863375bf __NSFastEnumerationMutationHandler + 303
>> 3 AppKit 0x7fff83ec8660 -[NSView trackingAreas] + 271
>> 4 AppKit 0x7fff83f1d025 -[NSView(NSInternal) _updateTrackingAreas] + 249
>> 
>> 
>> But all the tracking areas I am adding are done in the initialization of the 
>> views or awakeFromNib, and not updated after that. I do use tracking rects 
>> and tooltip rects, and wonder whether they use tracking areas behind the 
>> scenes, and whether there are specific places in the code I need to avoid 
>> changing them. 
>> 
>> I haven't been able to reproduce the problem here, so can't catch it in the 
>> act so far.
>> 
>> Any suggestions as to what to look for?
>> 
>> Thanks
>> 
>> Gideon
>> 

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


What could cause a fast enumeration mutation error in updating tracking areas?

2011-07-28 Thread Gideon King
Hi, I have a problem where a few users of my program are getting the following 
exception:

0 CoreFoundation 0x7fff862df7b4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x7fff84b0ff03 objc_exception_throw + 45
2 CoreFoundation 0x7fff863375bf __NSFastEnumerationMutationHandler + 303
3 AppKit 0x7fff83ec8660 -[NSView trackingAreas] + 271
4 AppKit 0x7fff83f1d025 -[NSView(NSInternal) _updateTrackingAreas] + 249
5 CoreFoundation 0x7fff86259d6e CFArrayApplyFunction + 222
6 AppKit 0x7fff83f1d413 -[NSView(NSInternal) _updateTrackingAreas] + 1255
7 CoreFoundation 0x7fff86259d6e CFArrayApplyFunction + 222
8 AppKit 0x7fff83f1d413 -[NSView(NSInternal) _updateTrackingAreas] + 1255
9 CoreFoundation 0x7fff86259d6e CFArrayApplyFunction + 222
10 AppKit 0x7fff83f1d413 -[NSView(NSInternal) _updateTrackingAreas] + 1255
11 CoreFoundation 0x7fff86259d6e CFArrayApplyFunction + 222
12 AppKit 0x7fff83f1d413 -[NSView(NSInternal) _updateTrackingAreas] + 1255
13 CoreFoundation 0x7fff86259d6e CFArrayApplyFunction + 222
14 AppKit 0x7fff83f1d413 -[NSView(NSInternal) _updateTrackingAreas] + 1255
15 CoreFoundation 0x7fff86259d6e CFArrayApplyFunction + 222
16 AppKit 0x7fff83f1d413 -[NSView(NSInternal) _updateTrackingAreas] + 1255
17 CoreFoundation 0x7fff86259d6e CFArrayApplyFunction + 222
18 AppKit 0x7fff83f1d413 -[NSView(NSInternal) _updateTrackingAreas] + 1255
19 AppKit 0x7fff83f1ce28 _handleInvalidCursorRectsNote + 451
20 CoreFoundation 0x7fff8629eb37 __CFRunLoopDoObservers + 519
21 CoreFoundation 0x7fff8627a464 __CFRunLoopRun + 468
22 CoreFoundation 0x7fff86279dbf CFRunLoopRunSpecific + 575
23 HIToolbox 0x7fff854f774e RunCurrentEventLoopInMode + 333
24 HIToolbox 0x7fff854f7553 ReceiveNextEventCommon + 310
25 HIToolbox 0x7fff854f740c BlockUntilNextEventMatchingListInMode + 59
26 AppKit 0x7fff83ef1eb2 _DPSNextEvent + 708
27 AppKit 0x7fff83ef1801 -[NSApplication 
nextEventMatchingMask:untilDate:inMode:dequeue:] + 155
28 AppKit 0x7fff83eb768f -[NSApplication run] + 395
29 OmniAppKit 0x00010055c774 -[OAApplication run] + 132
30 AppKit 0x7fff83eb03b0 NSApplicationMain + 364
31 NovaMind5 0x00012018 start + 52
32 ??? 0x0002 0x0 + 2


But all the tracking areas I am adding are done in the initialization of the 
views or awakeFromNib, and not updated after that. I do use tracking rects and 
tooltip rects, and wonder whether they use tracking areas behind the scenes, 
and whether there are specific places in the code I need to avoid changing 
them. 

I haven't been able to reproduce the problem here, so can't catch it in the act 
so far.

Any suggestions as to what to look for?

Thanks

Gideon




___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


  1   2   3   4   >