On 8/27/14, 12:32 PM, "Kyle Sluder" <[email protected]> wrote:

>> On Aug 27, 2014, at 8:43 AM, edward taffel <[email protected]> wrote:
>> 
>> 
>>> On Aug 27, 2014, at 11:30 AM, Matthew LeRoy <[email protected]> wrote:
>>> This seems to work in initial testing ‹ the alert displays ‹ but I get
>>>a message in the console telling me that ³NSAlert is being used from a
>>>background thread, which is not safe. This is probably going to crash
>>>sometimes. в Presumably this is because I have overridden
>>>+canConcurrentlyReadDocumentsOfType: to return YES for my documents,
>>>resulting in document reading happening on a background thread.
>>>Changing +canConcurrentlyReadDocumentsOfType: to return NO makes the
>>>warning message go away.
>> 
>> i had this problem too: you can show the alert on the main thread via
>>e.g. performSelectorOnMainThread. (as was kindly pointed out to me by,
>>if i remember correctly,  graham cox).
>
>I would not advise this. The main thread may itself be blocked due to
>waiting on your document via -performSychronousFileAccesdUsingBlock:.

Indeed. Further, performSelectorOnMainThread doesn¹t allow me to get the
value returned from the selector ([NSAlert runModal]), which I need in
order to know which choice the user name (update in place or duplicate).

>Matthew, could you perhaps perform automatic conversion, mark the
>document as untitled, and display a notice about automatic conversion
>once the document has been asked to -showWindows? This is the strategy
>I¹ve suggested implementing in our own apps in the future.

This seems to work, but now I have a different problem. If the original
file being opened is read-only or Locked via Finder (i.e. Immutable flag
is set), then the title bar of the document window always displays the
³Locked² modifier, despite any calls to setFileURL:nil, setDraft:YES, etc.
However, this seems to just be a case of desynchronization between the UI
and the underlying document, because if I attempt to make any edits once
the document is open the title bar immediately switches from ³Locked² to
³Edited² and I don¹t get the usual prompt, ³This document is locked, do
you want to Unlock, Duplicate, or Cancel?². Any ideas on how to get the
window to re-synchronize the title bar with the document state to get the
"Locked" modifier to go away? The behavior I want in this scenario is for
the title bar to display something like ³Untitled (copy of myFile.ext) -
Edited², and to always prompt the user for a save location when the
document is closed.


_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post 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 [email protected]

Reply via email to