What is NSView's anchorPoint/origin/axis for setFrameCenterRotation?

2012-09-06 Thread Eric Wing
I want to rotate an NSView around its center. (Example: Imagine me
rotating a magnetic compass around so the North pointer rotates around
to the bottom.

I thought setFrameCenterRotation would do this for me. But when I try
it (10.8), it always rotates about the bottom-left corner, not the
center. I thought this API was supposed to do it around the center and
setFrameRotation did the bottom-left corner. (Both do the bottom-left
for me.)

Am I losing my mind? Can somebody confirm the behavior? I can't tell
by the Apple docs.

Thanks,
Eric
-- 
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/
___

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: autosavesInPlace and sandbox

2012-09-06 Thread Graham Cox

On 07/09/2012, at 8:37 AM, Kyle Sluder  wrote:

> Opting in to
> +autosavesInPlace doesn't seem like it's there so you can decide whether
> to adopt it based on user feedback;


We've also had a lot of feedback from users who dislike this feature. Once 
again Apple are foisting things upon Mac users that they like, but which are 
widely disliked.

Whatever happened to 'the user is in charge'? While I can see the benefit of 
Autosave, I think the degree of disruption to the UI it creates is throwing out 
years of well-established familiarity for users and introducing behaviours that 
don't make much sense for many of them.

The feedback we've received is that a lot of users just haven't got any idea 
what's going on: why things suddenly open unbidden, odd messages that they are 
unsure how to respond to, and menus they aren't familiar with hiding behaviours 
that don't make sense. Many of these new features and behaviours have been 
called out as bugs in the app. Fact is, grafting on something that does make 
sense on a phone onto a desktop OS with a long tradition of doing things in a 
different way is confusing a lot of people. Apple might be pretending it isn't 
happening, but they've become the sort of company that no longer listens anyway.

For developers, NSDocument has become quite a muddle, and was always a fairly 
complex class to deal with (in terms of what gets called when). With 
sandboxing, autosave becomes effectively compulsory.


Has Mac OS X/Cocoa "jumped the shark"? I hope not but it's not clear that it 
hasn't.

--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: Best data source for table view in document window

2012-09-06 Thread Graham Cox

On 07/09/2012, at 4:36 AM, Jerry Krinock  wrote:

> But I'm still using my other triggers because sometimes my document opens 
> with no windows


Don't forget also that Cocoa will be creating instances of your document at all 
sorts of odd times with Autosave and Versions in play. This can play havoc with 
complex connections between elements of your app and throw up all sorts of 
weird bugs. Extensive testing is needed to catch all of these (and one reason I 
found using windowWillClose: was best for much of my tear-down in my case, 
because I skip the set-up associated with windows if there aren't any).

--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: autosavesInPlace and sandbox

2012-09-06 Thread Kyle Sluder
On Thu, Sep 6, 2012, at 03:27 PM, Georg Seifert wrote:
> I actually used autosave in place but my users did not like it at all. If
> you have to open a lot files all the time just to check something, you do
> not like that any mouse click might change your document and you are not
> asked if you what to keep it.
> 

I don't think you're going to have much of a choice soon. Opting in to
+autosavesInPlace doesn't seem like it's there so you can decide whether
to adopt it based on user feedback; it's there so you can fix bugs it
might introduce in your saving path before you release
autosaves-in-place to your users.

The experience on 10.8 is superior to that on 10.7.

--Kyle Sluder
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: autosavesInPlace and sandbox

2012-09-06 Thread Georg Seifert

On 06.09.2012, at 15:32, Mike Abdullah wrote:

> On 6 Sep 2012, at 13:36, Georg Seifert  wrote:
> 
>> Hi,
>> 
>> I have a problem. My app (documents based) does not support Lions Version 
>> (returns NO in autosavesInPlace). This worked fine until I had to sandbox my 
>> app. The problem is, that now the NSDocument autosaving tries to create a 
>> file called "My Document Name (Autosaved).myExtension" next to the document. 
>> But this is blocked by the sandbox. 
>> 
>> Is there any way to extend the permission to the autosave file or can I 
>> force NSDocument to always store the autosave files in the container?
> 
> What's stopping you adopting autosave-in-place?
> 
I actually used autosave in place but my users did not like it at all. If you 
have to open a lot files all the time just to check something, you do not like 
that any mouse click might change your document and you are not asked if you 
what to keep it.

Best
Georg
___

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: NSData DataWithContentsOfURL within a protocol handler

2012-09-06 Thread Jean Suisse
Yes, I meant GCD. Sorry I missed the part where you told us about supporting 
10.5 in your original message.


On 6 sept. 2012, at 20:55, Dan S wrote:

> if you meant using the grand central dispatch, i think that only became 
> available in 10.6, I need to support this for 10.5
>  
> On Thu, Sep 6, 2012 at 11:25 AM, Dan S  wrote:
> No, actually I've completely missed that it was answered.  Thank you. 
>  
> Unfortunatelly, the requester is expecting a return data, error or a 
> redirect. And until the api can be respeced, the sync response has to stay 
> in.  It isn't that it needs to load from network every request, but some 
> volotile data does have to check the server to pull down the changes before 
> serving the data.
>  
> I will try to offload the server access to a different thread (though I still 
> need to block the protocol thread because I still have to return the correct 
> data for the current call).
>  
> but now I'm also curiouse of what you mewant by posting a block to another 
> dispatch queue ?
>  

___

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: Collision between Cocoa classes for AU and VST plugins

2012-09-06 Thread MeldaProduction
Aaaah, ok ;) thanks. But now - will this actually help? I mean this
basically takes one class and creates another class from it realtime. But
if plugin A is created, then plugin B is created (which takes classes from
A unfortunatelly), wouldn't it also create the new classes from the A
superclasses? Because I see no reason why it should do it a different way.

Vojtech


2012/9/6 Olivier Tristan 

> check the git version.
> This has changed recently.
>
>
> http://juce.git.sourceforge.net/git/gitweb.cgi?p=juce/juce;a=blob_plain;f=modules/juce_core/native/juce_osx_ObjCHelpers.h;h=6f643705923e6a0319ddcb7b4dd616a303500df7;hb=refs/heads/master
>
>
> On Thu, Sep 6, 2012 at 10:58 PM, MeldaProduction  > wrote:
>
>>   Create cocoa class at runtime

 You can check how this is done in Juce, especially in the AU wrapper.
 http://www.rawmaterialsoftware.com/juce/

 HTH

>>>
>>> Thanks. One trouble - I checked and I didn't find any runtime cocoa
>>> class creation - they seem to have special Cocoa views for AU. But I'm
>>> worried about this, because even if I'd create special classes for all
>>> interfaces (which is sick, but ok...) by subclassing my default view class,
>>> what is the odds that the god damn system will use the class from the first
>>> loaded module anyway, they will be there too obviously. Any ideas?
>>> Or can you point me out into Juce, where the thing is supposed to be?
>>>
>>>  Vojtech
>>>
>>>
>>>  check juce_osx_ObjCHelpers.h, ObjCClass class and its use
>>>
>>
>> Thanks, but I must be missing something. I'm looking at Juce 2.0 and I
>> found nothing that would even closely remind runtime cocoa class creation.
>> juce_osx_ObjCHelpers.h only contains some postfix creation, similar to what
>> I use in my plugins to ensure plugin A won't take classes from B. But I
>> meant a different problem - in my case plugin A is actually the same as B,
>> same binary, same resource, everything... But one is used as VST plugin,
>> the other as AU plugin. Then the names of the classes are obviously the
>> same, so I just need to ensure binary A will take classes from A despite
>> they are also in B.
>>
>> Vojtech
>>
>>
>
>
> --
> [image: UVI] 
> Olivier Tristan | Research & Development
> o.tris...@uvi.net 
>
> [image: Facebook]  [image: 
> Twitter]
>  [image: Youtube]  [image:
> SoundCloud]  [image: Blog 
> UVI]
>
>
___

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: Collision between Cocoa classes for AU and VST plugins

2012-09-06 Thread MeldaProduction
>
>  Create cocoa class at runtime
>>
>> You can check how this is done in Juce, especially in the AU wrapper.
>> http://www.rawmaterialsoftware.com/juce/
>>
>> HTH
>>
>
> Thanks. One trouble - I checked and I didn't find any runtime cocoa class
> creation - they seem to have special Cocoa views for AU. But I'm worried
> about this, because even if I'd create special classes for all interfaces
> (which is sick, but ok...) by subclassing my default view class, what is
> the odds that the god damn system will use the class from the first loaded
> module anyway, they will be there too obviously. Any ideas?
> Or can you point me out into Juce, where the thing is supposed to be?
>
>  Vojtech
>
>
>  check juce_osx_ObjCHelpers.h, ObjCClass class and its use
>

Thanks, but I must be missing something. I'm looking at Juce 2.0 and I
found nothing that would even closely remind runtime cocoa class creation.
juce_osx_ObjCHelpers.h only contains some postfix creation, similar to what
I use in my plugins to ensure plugin A won't take classes from B. But I
meant a different problem - in my case plugin A is actually the same as B,
same binary, same resource, everything... But one is used as VST plugin,
the other as AU plugin. Then the names of the classes are obviously the
same, so I just need to ensure binary A will take classes from A despite
they are also in B.

Vojtech
___

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: NSData DataWithContentsOfURL within a protocol handler

2012-09-06 Thread Jens Alfke

On Sep 6, 2012, at 1:21 PM, Dan S  wrote:

> I can return from
> the routine without completing the request, while the caller will be kept
> blocked on that request untill I respond with URLProtocolDidFinishLoading

Well, the caller probably won’t be blocked, since it should be using an async 
API. But that doesn’t matter to you as the protocol.

> Except can I get a confirmation please that the client using the protocol
> handler will not reuse it untill request is completed (i.e. it wont use the
> same instance to make another request once I return from -startLoading,
> untill it gets a completion like a final redirect or
> URLProtocolDidFinishLoading)??

An instance is only ever used once, for a single request.

> So, following your suggestion, to avoid calling URLProtocolDidFinishLoading 
> from the thread, what would be preferable for calling it from main thread? 
> performSelectorOnMainthread or listening to threadWillTerninate notification? 
> or something else?

If you just use the asynchronous API from your protocol handler, the delegate 
callbacks will all happen on the same thread, so you don’t have to worry about 
threading at all.

If you want to run your loading on a separate thread, you’ll need to remember 
the identity of the thread that -startLoading was called on (it is not the main 
thread) and call the client on that thread. You can use 
-performSelector:onThread:withObject:waitUntilDone: to do this.

—Jens
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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

Re: NSData DataWithContentsOfURL within a protocol handler

2012-09-06 Thread Dan S
hehe, yes thank you, I was definatelly treating -startLoading it as the end
all call.  So, following your suggestion, to avoid
calling URLProtocolDidFinishLoading from the thread, what would be
preferable for calling it from main thread? performSelectorOnMainthread or
listening to threadWillTerninate notification? or something else?

and should I assume that the initial -startLoading came from the main
thread or should I poll for which thread it came from and performSelector
on that thread (in which case am I guaranteed that that particular thread
is still running if it is not main)?

On Thu, Sep 6, 2012 at 1:19 PM, Jens Alfke  wrote:

>
>  On Sep 6, 2012, at 11:25 AM, Dan S  wrote:
>
> I will try to offload the server access to a different thread (though I
> still need to block the protocol thread because I still have to return the
> correct data for the current call).
>
>
> No — as I said before, you should _never_ block the protocol-handler
> thread.
>
> I think you’re misunderstanding how NSURLProtocol works. When your
> -startLoading method is called, it does not have to send a response to the
> client immediately. Unless you have data already available (unlikely in
> your case) you should just kick off your own async request for the data,
> and then immediately return. Later on as the data arrives, you can call
> your client with the response and data. After everything’s done, call the
> client’s URLProtocolDidFinishLoading:. (The only restriction seems to be
> that you must call the client from the protocol-handler thread, i.e. the
> same thread -startLoading was called on. I’ve tried to do otherwise and it
> didn’t work well.)
>
> —Jens
>
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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

Re: NSData DataWithContentsOfURL within a protocol handler

2012-09-06 Thread Dan S
doh!  I've been treating -startLoading as a sync routine that must return a
final result to the caller, and just now realized that I can return from
the routine without completing the request, while the caller will be kept
blocked on that request untill I respond with URLProtocolDidFinishLoading
(and from a different thread if need to) so the "rewrite your code async"
comment all of a sudden sounds great :)

Except can I get a confirmation please that the client using the protocol
handler will not reuse it untill request is completed (i.e. it wont use the
same instance to make another request once I return from -startLoading,
untill it gets a completion like a final redirect or
URLProtocolDidFinishLoading)??

Basically I'm trying to confirm that I don't have to save the request
somewhere else and keep track of it separately outside of the initial
NSURLProtocol instance itself.



On Thu, Sep 6, 2012 at 11:55 AM, Dan S  wrote:

> if you meant using the grand central dispatch, i think that only became
> available in 10.6, I need to support this for 10.5
>
>
> On Thu, Sep 6, 2012 at 11:25 AM, Dan S  wrote:
>
>> No, actually I've completely missed that it was answered.  Thank you.
>>
>> Unfortunatelly, the requester is expecting a return data, error or a
>> redirect. And until the api can be respeced, the sync response has to stay
>> in.  It isn't that it needs to load from network every request, but some
>> volotile data does have to check the server to pull down the changes before
>> serving the data.
>>
>> I will try to offload the server access to a different thread (though I
>> still need to block the protocol thread because I still have to return the
>> correct data for the current call).
>>
>> but now I'm also curiouse of what you mewant by posting a block to
>> another dispatch queue ?
>>
>>
>> On Thu, Sep 6, 2012 at 7:55 AM, Jean Suisse  wrote:
>>
>>> Hi,
>>>
>>> Fritz Anderson is right. We can only agree.
>>> And recently, they made following Jens Alfke's advice incredibly easy.
>>> Just post a block to one of the available dispatch queues (not the one
>>> running on your main thread thought) and let it run its curse.
>>>
>>> Jean
>>>
>>> On 6 sept. 2012, at 16:36, Fritz Anderson wrote:
>>>
>>> > From what Google tells me, you got a prompt response from Jens Alfke,
>>> a very experienced Cocoa-networking programmer, explaining why what you're
>>> doing shouldn't be expected to work. Are you looking for a workaround, or
>>> just for somebody who will give you better news? I don't think better news
>>> is in the cards.
>>>
>>>
>>> On 29 août 2012, at 22:58, Jens Alfke wrote:
>>>
>>> > If you must use a synchronous API, spawn a new thread to run it on.
>>> >
>>>
>>>
>>>
>>>
>>
>
___

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: NSData DataWithContentsOfURL within a protocol handler

2012-09-06 Thread Jens Alfke

On Sep 6, 2012, at 11:25 AM, Dan S  wrote:

> I will try to offload the server access to a different thread (though I
> still need to block the protocol thread because I still have to return the
> correct data for the current call).

No — as I said before, you should _never_ block the protocol-handler thread.

I think you’re misunderstanding how NSURLProtocol works. When your 
-startLoading method is called, it does not have to send a response to the 
client immediately. Unless you have data already available (unlikely in your 
case) you should just kick off your own async request for the data, and then 
immediately return. Later on as the data arrives, you can call your client with 
the response and data. After everything’s done, call the client’s 
URLProtocolDidFinishLoading:. (The only restriction seems to be that you must 
call the client from the protocol-handler thread, i.e. the same thread 
-startLoading was called on. I’ve tried to do otherwise and it didn’t work 
well.)

—Jens
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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

Re: View based outline view and custom NSTableCellViews

2012-09-06 Thread Jean Suisse
To add a few more informations:

If I manually write the outlet declaration in MyTableCellView.h 
(@property(weak) NSTextField* myTextField); and if I add the @synthesize method 
in the .m file, this time, IB is letting me do the connection.
However, IB is presenting me with a window I am not familiar with [1], 
requesting additional informations, related to bindings. So far, I haven't been 
able to make it work.

Jean

[1] such as Bind (set to DisplayPattern Value1), controller (set to My table 
cell view, the name of the view in IB), the name of the custom class (set to 
MyTableCellView), the keypath (set by default to objectvalue, the key should be 
here), the model object, set to MyTableCellView, an other keypath, set to 
MyTextField.


On 6 sept. 2012, at 20:34, Jean Suisse wrote:

> Thank you for your reply.
> 
>> Elaborate on "not letting me do that."
> 
> That is Ctrl + drag from the textfield I added in the TableCellView (declared 
> to ID as MyTableCellView) towards the header file MyTableCellView.h (to 
> declare the property + declare the outlet in one shot).
> Also, if I create them manually, IB is refusing to do the connection.
> 
> 
> Jean
> 
> 
> On 6 sept. 2012, at 19:11, Seth Willits wrote:
> 
>> 
>> On Sep 6, 2012, at 7:46 AM, Jean Suisse wrote:
>> 
>>> Instinctively, I would create a subclass of NSTableCellView 
>>> (MyTableCellView), set the NSTableCellView to be MyTableCellView in IB and 
>>> connect all the outlets to be able to do this at runtime : 
>>> [MyTableCellView.MyExtraTextField setXXXValue: …];
>> 
>> That's exactly what you do. 
>> 
>> 
>>> But IB is not letting me do that. What did I miss ? They do that in the 
>>> example provided by apple.
>> 
>> 
>> I suspect you're grabbing the wrong thing in IB, or IB doesn't know about 
>> your cell view subclass etc. The usual things. It's like any other custom 
>> class stuff in IB, so there aren't any hidden tricks involved.
>> 
>> Elaborate on "not letting me do that."
>> 
>> 
>> --
>> Seth Willits
>> 
>> 
>> 
>> 
>> 
>> ___
>> 
>> 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/jean.lists%40gmail.com
>> 
>> This email sent to jean.li...@gmail.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: NSData DataWithContentsOfURL within a protocol handler

2012-09-06 Thread Dan S
if you meant using the grand central dispatch, i think that only became
available in 10.6, I need to support this for 10.5


On Thu, Sep 6, 2012 at 11:25 AM, Dan S  wrote:

> No, actually I've completely missed that it was answered.  Thank you.
>
> Unfortunatelly, the requester is expecting a return data, error or a
> redirect. And until the api can be respeced, the sync response has to stay
> in.  It isn't that it needs to load from network every request, but some
> volotile data does have to check the server to pull down the changes before
> serving the data.
>
> I will try to offload the server access to a different thread (though I
> still need to block the protocol thread because I still have to return the
> correct data for the current call).
>
> but now I'm also curiouse of what you mewant by posting a block to another
> dispatch queue ?
>
>
> On Thu, Sep 6, 2012 at 7:55 AM, Jean Suisse  wrote:
>
>> Hi,
>>
>> Fritz Anderson is right. We can only agree.
>> And recently, they made following Jens Alfke's advice incredibly easy.
>> Just post a block to one of the available dispatch queues (not the one
>> running on your main thread thought) and let it run its curse.
>>
>> Jean
>>
>> On 6 sept. 2012, at 16:36, Fritz Anderson wrote:
>>
>> > From what Google tells me, you got a prompt response from Jens Alfke, a
>> very experienced Cocoa-networking programmer, explaining why what you're
>> doing shouldn't be expected to work. Are you looking for a workaround, or
>> just for somebody who will give you better news? I don't think better news
>> is in the cards.
>>
>>
>> On 29 août 2012, at 22:58, Jens Alfke wrote:
>>
>> > If you must use a synchronous API, spawn a new thread to run it on.
>> >
>>
>>
>>
>>
>
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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

Re: Best data source for table view in document window

2012-09-06 Thread Jerry Krinock

On 2012 Sep 05, at 21:13, Martin Hewitson  wrote:

> I already had a -cleanUp method being called from -windowWillClose: within 
> the NSDocument

I just checked my code again and found that I am already using 
-windowWillClose: as suggested by Graham, for the stuff in the window, and a 
quick test shows that -windowWillClose: is invoked earlier than my other 
triggers.  But I'm still using my other triggers because sometimes my document 
opens with no windows, and there may be other programmatic ways that closing 
can be initiated.

> (NSPersistentDocument, actually)

Oh, that's even more fun!  But apparently not related to the crash you're 
reporting.

> I have in the back of my mind a memory about timers retaining their target, 
> but I think I handle that in the accepted way by calling -invalidate on the 
> timer.

Yes, it looks OK to me.
> 
> Maybe I shouldn't care about the order in which my dealloc messages appear?

Yes, because you've already removed all vulnerable references in 
-windowWillClose:

> With this new scheme described above, I've been able to open and close a 
> document many 10's of times without a crash. But somehow I have a nagging 
> doubt that I've really nailed this down.

Use the software equivalent of Accelerated Life Testing.  If your app is 
scriptable, write a script to open, stress, and close a document, and let it 
loop for several days.  If not scriptable, either make it scriptable (which may 
have unforeseen future re-use), or patch in a temporary bonehead loop.


___

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: CA_DEBUG_TRANSACTIONS=1

2012-09-06 Thread Eric Wing
On 9/5/12, John MacMullin  wrote:
> I am getting the following message:  CoreAnimation: warning, deleted thread
> with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in environment
> to log backtraces.
>
> What in general would be causing this?
>


Just another data point. This recently started appearing in my code
when running in 10.8. It's been hard to track down, but I'm now
certain the problem was in Apple's IKImageView implementation (i.e. an
Apple bug) which I had no control over. I think this was sometimes
leading to crashes as well. The problem is hard to reproduce, but my
theory is that changing a property on the IKImageView while it was
animating or removing/releasing the view while it was animating would
cause this. Since I discovered a serious memory leak in the framework
too, I had to ditch using it completely. All these problems went away
when I did that.

But the overall point is that the message can also be generated by
Apple's own frameworks and it is possible that it not coming from your
code. 10.8 in particular seemed to make a lot of changes to Core
Animation under the hood to make it more multithreaded which may have
also created new bugs.

-Eric
-- 
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/
___

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: NSData DataWithContentsOfURL within a protocol handler

2012-09-06 Thread Dan S
No, actually I've completely missed that it was answered.  Thank you.

Unfortunatelly, the requester is expecting a return data, error or a
redirect. And until the api can be respeced, the sync response has to stay
in.  It isn't that it needs to load from network every request, but some
volotile data does have to check the server to pull down the changes before
serving the data.

I will try to offload the server access to a different thread (though I
still need to block the protocol thread because I still have to return the
correct data for the current call).

but now I'm also curiouse of what you mewant by posting a block to another
dispatch queue ?


On Thu, Sep 6, 2012 at 7:55 AM, Jean Suisse  wrote:

> Hi,
>
> Fritz Anderson is right. We can only agree.
> And recently, they made following Jens Alfke's advice incredibly easy.
> Just post a block to one of the available dispatch queues (not the one
> running on your main thread thought) and let it run its curse.
>
> Jean
>
> On 6 sept. 2012, at 16:36, Fritz Anderson wrote:
>
> > From what Google tells me, you got a prompt response from Jens Alfke, a
> very experienced Cocoa-networking programmer, explaining why what you're
> doing shouldn't be expected to work. Are you looking for a workaround, or
> just for somebody who will give you better news? I don't think better news
> is in the cards.
>
>
> On 29 août 2012, at 22:58, Jens Alfke wrote:
>
> > If you must use a synchronous API, spawn a new thread to run it on.
> >
>
>
>
>
___

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: CA_DEBUG_TRANSACTIONS=1

2012-09-06 Thread Kyle Sluder
On Thu, Sep 6, 2012, at 09:09 AM, John MacMullin wrote:
> More or less.
> 
> It appears that since the documentation in NSBundle does not state that
> its thread safe, it isn't.

This really isn't the whole story. NSBundle isn't thread-safe (don't
send it messages from multiple threads), but is probably safe to use
from non-main threads, as long as it's only used from one thread.

By contrast, you should NEVER load a nib from a background thread.
AppKit is very dependent on running on the main thread.

> 
> From Core Animation tho, it would appear that executing a CATransaction
> flush may have resolved my original message, but perhaps not the problem.
> 
> If I read this correctly, this updates the layers, which wouldn't
> otherwise be updated on a background thread.

Doubtful; +flush pushes values from the model tree to the presentation
tree, but it doesn't actually close a transaction. You'd still have an
open transaction when the thread was exited.

> 
> It would seem that if I call a non-thread safe function in a background
> thread, i.e., from an NSOperationQueue, that a compile or other error
> should result.

In order to know that you're doing this, the compiler would need to be
able to simulate execution of your code. Given the design of the C type
system and program execution model, this is an impossibility. You cannot
build a compiler with this functionality that will also allow
compilation of all valid C programs. You could design a language with
this safety feature (for example, a "background" attribute built into
the type system), but there would then exist valid programs that the
compiler would reject. C prefers to let you shoot yourself in the foot
rather than restrict you from writing programs simply because the
compiler cannot prove they are correct.

--Kyle Sluder
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: View based outline view and custom NSTableCellViews

2012-09-06 Thread Seth Willits

On Sep 6, 2012, at 7:46 AM, Jean Suisse wrote:

> Instinctively, I would create a subclass of NSTableCellView 
> (MyTableCellView), set the NSTableCellView to be MyTableCellView in IB and 
> connect all the outlets to be able to do this at runtime : 
> [MyTableCellView.MyExtraTextField setXXXValue: …];

That's exactly what you do. 


> But IB is not letting me do that. What did I miss ? They do that in the 
> example provided by apple.


I suspect you're grabbing the wrong thing in IB, or IB doesn't know about your 
cell view subclass etc. The usual things. It's like any other custom class 
stuff in IB, so there aren't any hidden tricks involved.

Elaborate on "not letting me do that."


--
Seth Willits





___

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: CA_DEBUG_TRANSACTIONS=1

2012-09-06 Thread John MacMullin
More or less.

It appears that since the documentation in NSBundle does not state that its 
thread safe, it isn't.

>From Core Animation tho, it would appear that executing a CATransaction flush 
>may have resolved my original message, but perhaps not the problem.

If I read this correctly, this updates the layers, which wouldn't otherwise be 
updated on a background thread.

It would seem that if I call a non-thread safe function in a background thread, 
i.e., from an NSOperationQueue, that a compile or other error should result.

On Sep 5, 2012, at 5:48 PM, Kyle Sluder  wrote:

> On Sep 5, 2012, at 5:13 PM, John MacMullin  wrote:
> 
>> Ok, that was it.  I loaded [NSBundle loadNibNamed:XXX] in a background 
>> thread.
>> 
>> Fixing that problem resolved the message.
> 
> Did the process of fixing it also illuminate other areas you seem to be hazy 
> on, such as how Core Animation works, why loading nibs on background threads 
> is always incorrect, and how the debugger fits into the Xcode 
> edit/compile/debug cycle?
> 
> --Kyle Sluder

Best regards,

John MacMullin
___

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: Collision between Cocoa classes for AU and VST plugins

2012-09-06 Thread MeldaProduction
>
> there are hosts that can use both AU and VST (and potentially VST3)
> interfaces for plugins. But there's a big catch - crappy Cocoa design. My
> plugins are obviously the same for all the interfaces and simply provide
> all interface implementations, so the they can be both AU and VST, just
> depending on where you put it and what extension you give to the bundle.
> BUT when you then use e.g. Ableton Live and open the same plugin first
> using VST and then using AU, boom you have a crash, because when VST has
> been open, system checked for Cocoa GUI classes in the VST version and then
> when you open the AU plugin it uses the GUI class from the VST version,
> because they have the same name! So it starts using resources from the VST
> version etc... lots of bad stuff can happen. How to solve it? For different
> plugins it is solved by adding some postfix to the class names, which is
> just sad, but at least it solved the issue. But here I don't see a way
> without providing different executables for VST and AU, which is a no go.
> Any ideas?
>
>
> Create cocoa class at runtime
>
> You can check how this is done in Juce, especially in the AU wrapper.
> http://www.rawmaterialsoftware.com/juce/
>
> HTH
>

Thanks. One trouble - I checked and I didn't find any runtime cocoa class
creation - they seem to have special Cocoa views for AU. But I'm worried
about this, because even if I'd create special classes for all interfaces
(which is sick, but ok...) by subclassing my default view class, what is
the odds that the god damn system will use the class from the first loaded
module anyway, they will be there too obviously. Any ideas?
Or can you point me out into Juce, where the thing is supposed to be?

Vojtech
___

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


Cocoa/Xcode/Graph Tutorial Movie

2012-09-06 Thread lbland
hi-

Some people might find this Xcode/Cocoa movie interesting:

http://www.vvidget.org/develop/movies/maclinegraph.mov

thanks!-

-lance

___

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: NSData DataWithContentsOfURL within a protocol handler

2012-09-06 Thread Jean Suisse
Hi,

Fritz Anderson is right. We can only agree. 
And recently, they made following Jens Alfke's advice incredibly easy. 
Just post a block to one of the available dispatch queues (not the one running 
on your main thread thought) and let it run its curse. 

Jean

On 6 sept. 2012, at 16:36, Fritz Anderson wrote:

> From what Google tells me, you got a prompt response from Jens Alfke, a very 
> experienced Cocoa-networking programmer, explaining why what you're doing 
> shouldn't be expected to work. Are you looking for a workaround, or just for 
> somebody who will give you better news? I don't think better news is in the 
> cards.


On 29 août 2012, at 22:58, Jens Alfke wrote:

> If you must use a synchronous API, spawn a new thread to run it on.
> 




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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

View based outline view and custom NSTableCellViews

2012-09-06 Thread Jean Suisse
Hello,

In the content view of the window of a freshly created NIB, I have a view-based 
outline view. The file owner is set to be MyWindowController. The outlineView 
is the standard, preconfigured setup, dragged from IB.
Now, I would like to modify the "default" views provided in this standard 
setup, to integrate my custom controls. And I am stuck on the part where, at 
runtime, I access those custom controls to make them display the appropriate 
information.

If I add, for instance, an NSTextField label to the dataView, how do I access 
it at runtime to change its value ? I know where I should do that. But I can't 
do it because of the lack of outlet.
Instinctively, I would create a subclass of NSTableCellView (MyTableCellView), 
set the NSTableCellView to be MyTableCellView in IB and connect all the outlets 
to be able to do this at runtime : [MyTableCellView.MyExtraTextField 
setXXXValue: …];

But IB is not letting me do that. What did I miss ? They do that in the example 
provided by apple.

Best regards, 
Jean


___

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: NSData DataWithContentsOfURL within a protocol handler

2012-09-06 Thread Fritz Anderson
From what Google tells me, you got a prompt response from Jens Alfke, a very 
experienced Cocoa-networking programmer, explaining why what you're doing 
shouldn't be expected to work. Are you looking for a workaround, or just for 
somebody who will give you better news? I don't think better news is in the 
cards.

— F

On 5 Sep 2012, at 7:59 PM, danchik  wrote:

> Hello, is there a recomendation of a better list for this question ?
> 
> - Original Message - From: "danchik" 
> To: 
> Sent: Thursday, August 02, 2012 3:33 PM
> Subject: NSData DataWithContentsOfURL within a protocol handler
> 
> 
>> Hello, I was callingNSData *data = [NSData DataWithContentsOfURL:url 
>> within the -startLoading of custom protocol handler, which worked fine for 
>> 10.5 through 10.7, but in 10.8, for some reason the call timesout with 
>> unknown error (256)
>> 
>> Seems that in 10.8 any calls I make to pull the content form the web using 
>> NSString or NSData or NSURLConnection will time out if I am in the custom 
>> protocol handler inside the -startLoading
>> 
>> Seems like it is waiting for me to return before it will process the 
>> command, is there a way I can make a syncronouse url content pull from 
>> within the -startLoading protocol handler?


___

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: autosavesInPlace and sandbox

2012-09-06 Thread Mike Abdullah

On 6 Sep 2012, at 13:36, Georg Seifert  wrote:

> Hi,
> 
> I have a problem. My app (documents based) does not support Lions Version 
> (returns NO in autosavesInPlace). This worked fine until I had to sandbox my 
> app. The problem is, that now the NSDocument autosaving tries to create a 
> file called "My Document Name (Autosaved).myExtension" next to the document. 
> But this is blocked by the sandbox. 
> 
> Is there any way to extend the permission to the autosave file or can I force 
> NSDocument to always store the autosave files in the container?

What's stopping you adopting autosave-in-place?


___

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


autosavesInPlace and sandbox

2012-09-06 Thread Georg Seifert
Hi,

I have a problem. My app (documents based) does not support Lions Version 
(returns NO in autosavesInPlace). This worked fine until I had to sandbox my 
app. The problem is, that now the NSDocument autosaving tries to create a file 
called "My Document Name (Autosaved).myExtension" next to the document. But 
this is blocked by the sandbox. 

Is there any way to extend the permission to the autosave file or can I force 
NSDocument to always store the autosave files in the container?

Thanks
Georg
___

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


Advice for rotating content in a window so it doesn't get clipped

2012-09-06 Thread Eric Wing
I have a bunch of content in a non-square window I want to rotate with
setFrameCenterRotation (using the animator). The content fills the
existing window perfectly (i.e. to the edges), so for it to not be
clipped on the edges of the window when it rotates, I need to increase
the window size temporarily in all 4 directions.

I want the thing I'm rotating to stay centered relative to its
original screen position, so when I resize the window, I need the view
to not shift in absolute terms despite the fact that the window's
origin (lower-left corner) will need to move.

I'm looking for ideas on the best/easiest way of accomplishing this.

Additional details: My window is already transparent/borderless. My
existing content is done programmatically (no nibs).

Thanks,
Eric
-- 
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/
___

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