This should be handled automatically by NSDocumentController’s implementation
of -validateUserInterfaceItem: / -validateMenuItem:. Any chance you’re
overriding either of those methods and returning YES for menu items you don’t
own (instead of calling super)?
> On Oct 6, 2017, at 4:13 PM, Shane
Drafts are documents that have been autosaved in a user-visible location (i.e.
the app’s iCloud container) and therefore aren’t typical “Untitled” documents
from the programmer’s perspective as their fileURL property is not nil.
However, they still behave like “Untitled” documents in that they w
NSSavePanelDelegate is probably the approach you want to take, with
-[NSDocument prepareSavePanel:] being the most convenient means of inserting
your delegate.
> On Feb 10, 2017, at 9:41 AM, Quincey Morris
> wrote:
>
> On Feb 10, 2017, at 08:12 , Trygve Inda wrote:
>>
>> I would like to dis
> On Mar 30, 2015, at 5:17 PM, Daryle Walker wrote:
>
>> On Mar 30, 2015, at 7:59 PM, Kevin Perry > <mailto:kpe...@apple.com>> wrote:
>>
>> -replaceItemAtURL:… relies on the atomicity of the POSIX rename() function
>> in order to safely do its ope
Hi Daryle,
-replaceItemAtURL:… relies on the atomicity of the POSIX rename() function in
order to safely do its operation. Since rename() doesn’t work across volumes
(returning EXDEV), the two URLs must be on the same volume.
If you’re using a temporary directory with replaceItemAtURL:…, you wa
NSUserDirectory refers to the “Users” directory, which exists only in the
“System” domain (“/Users"). The “User” domain is the home directory (“~”). The
combination of NSUserDirectory and NSUserDomainMask results in a nonsensical
and nonexistent path (“~/Users”) so it returns nil/empty instead.
Using -makeDocumentForURL:nil withContentsOfURL:non-nil was originally designed
around the idea of reopening a document that was autosaved into
~/Library/Autosave Information after crash recovery or via the post-Lion
"Restore" feature. When such documents are closed without saving, it is desired
If you wanted to try this, you should also override
-updateChangeCountWithToken:forSaveOperation:, which is used to decrement
change counts after saving.
I expect this would get you 99% of the way, but as Seth said, don't expect it
to be bulletproof.
On Oct 18, 2013, at 11:49 AM, Seth Willits
> NSTextStorage instances, one for each file that's being managed, and swap
>> those in and out by doing setTextView on the storage instance. So is this
>> somehow bypassing the chain of notifications that tells NSTextFinder that
>> the string changed? Any way
On Sep 20, 2013, at 10:00 AM, Martin Hewitson
wrote:
> Dear list,
>
> I have an editor app which presents a list of files that can be edited.
> Selecting a file displays the text contents in an NSTextView subclass. On
> 10.7 and later the app supports using the FindBar. Searching the current
lock. So in this case a
> "File Access" block apparently can't be used.
FYI: You can get help discovering the cause of hangs involving
performSynchronousFileAccessUsingBlock (and
performActivityWithSynchronousWaiting:usingBlock:) by doing 'po
_NSDocumentSerializationInfo()&
Re-using a single NSDocument instance to represent several different files is
certainly atypical…
But, I suspect the problem here is that you're not using File Coordination when
reading in the contents of the new file. By not doing that, you're not giving
File Coordination the hint that it need
Sounds like a bug that you should report via Bug Reporter.
But as a workaround, you should be able to call -[NSTextView
setIncrementalSearchingEnabled:NO] when the subview gets collapsed (then
obviously set it back to YES when the text view is uncollapsed, though you will
lose search results in
On Apr 25, 2013, at 10:05 AM, Quincey Morris
wrote:
>> I can't begin to count the number of times I've opened documents, edited
>> them in some way, not intending to save those changes. Maybe I just needed
>> to, say, find an image in a particular layer of some image editing app, so I
>> hid
That might work, though I would probably recommend overriding at
-saveToURL:ofType:forSaveOperation:completionHandler: instead, and only modify
the path if saveOperation == NSAutosaveElsewhereOperation. If you override at
that level, setAutosavedContentsFileURL: will be invoked for you when the
At the moment, the only open panel that gets the iCloud treatment is the one
created by -[NSDocumentController openDocument:] or -[NSDocumentController
beginOpenPanelWithCompletionHandler:].
-KP
On Apr 3, 2013, at 8:29 PM, Kurt Sutter wrote:
> Dear all
>
> We are trying to make our applicati
I think you want to use -setShouldCascadeWindows:NO.
On Mar 13, 2013, at 2:20 PM, Steve Mills wrote:
> I've spent most of the day researching and coding this, but still don't have
> it perfect. I need to position our new document windows so they aren't
> covered by palettes that might be visib
On Jan 30, 2013, at 1:27 PM, Steve Mills wrote:
> On Jan 30, 2013, at 15:15:32, Kevin Perry
> wrote:
>
>> On Jan 30, 2013, at 12:32 PM, Steve Mills wrote:
>>
>>> I finally got this all figured out. This is a mess. It's goofy that Apple
>>> dec
On Jan 30, 2013, at 12:32 PM, Steve Mills wrote:
> On Jan 25, 2013, at 16:42:01, Kevin Perry wrote:
>
>> If you’re using your own accessory view instead of the built-in one
>> (shouldRunSavePanelWithAccessoryView), you’re responsible for changing the
>> value of file
If you’re using your own accessory view instead of the built-in one
(shouldRunSavePanelWithAccessoryView), you’re responsible for changing the
value of fileTypeFromLastRunSavePanel. One way to do this is to make your
NSDocument instance the target of the popup button’s action and change an
inte
On Dec 13, 2012, at 4:24 PM, Greg Parker wrote:
> On Dec 13, 2012, at 4:13 PM, Robert Monaghan wrote:
>> I went ahead and created a really crude subclass of NSMutableData. It seems
>> to work for my situation.
>> Attached is the code, for posterity. (I am sure I won't be the only one
>> worki
x27;t
copy and throws an exception when something tries to change the length. That
would violate the Liskov substitution principle though, so at the very least,
you want to prevent any code that doesn't understand the fixed-length
restriction from getting ahold of one of these objects.
[kevi
;
> On 9/21/12 6:49 PM, Kevin Perry wrote:
>> Oh dear. Forget you heard me mention anything about unpublished API. The
>> lack of an "_" threw me off...
>>
>> Yes, you'll probably want to keep your own flag.
>>
>> -KP
>>
>> On Se
n NSDocument
> or NSWindowController, did you mean to say that I'll have to keep a flag
> myself?
>
> Regards
> Markus
>
> On 9/20/12 6:53 PM, Kevin Perry wrote:
>> This is an known and unfortunate result of the current architecture of
>> NSWindow, NS
or -shouldCloseDocument is YES, then this will also
-close the document."
The best way around this at the moment is to first verify [self isClosed] == NO
before calling super and doing your own work.
[kevin perry];
On Sep 19, 2012, at 1:06 PM, Markus Spoettl wrote:
> Why doe
Looks like the crash is happening while attempting to invoke
-respondsToSelector:.
Odds are that this is a message being sent to [self delegate], which looks like
a deallocated object.
Is it possible that the split view is outliving its delegate? Typically, when a
delegate gets deallocated (or
A stab in the dark: Have you tried running with OBJC_PRINT_REPLACED_METHODS
set? There's a small chance that you have code in your app or a library that
you're linking that replaces via category a method implementation internal to
AppKit that +underPageBackgroundColor relies on.
Also, it might
You should probably try -[NSFileManager
enumeratorAtURL:includingPropertiesForKeys:options:errorHandler:]. The
errorHandler block will give you more detail about any errors that occur in the
middle of the enumeration (and give you the ability to ignore them).
-KP
On Jul 27, 2012, at 9:44 AM, M
On Jul 23, 2012, at 10:51 AM, Markus Spoettl wrote:
> On 7/23/12 6:22 PM, Kyle Sluder wrote:
>> I don't have my crazy autosave flowchart handy, but I *think* you should be
>> able to simply override -hasUnautosavedChanges to return YES if either super
>> returns YES or if your preferences file
I can't really recommend an approach that essentially lies about the "dirty"
state of a document. If you have something to write into the document bundle,
then the document is dirty and it should be declared so with the available
NSDocument APIs. If the existing APIs don't meet your needs for wh
-revertToContentsOfURL:ofType:error: (once the version's contents are
written in place over the existing file).
[kevin perry];
On Jun 25, 2012, at 1:44 PM, qvacua wrote:
> Hi,
>
> are there notifications or delegate methods of NSDocument (or
> NSDocumentController) which are called when
On May 23, 2012, at 9:43 AM, Martin Hewitson wrote:
>> It is indeed -updateChangeCount: that controls the 'Edited' state. You might
>> try overriding with a call to super and setting a breakpoint or adding a log
>> to make sure it's being called as expected (with NSChangeDone). That should
>>
Does "Revert to Last Saved" become available after saving and editing? Which
NSDocument methods are you overriding?
It is indeed -updateChangeCount: that controls the 'Edited' state. You might
try overriding with a call to super and setting a breakpoint or adding a log to
make sure it's being c
Unless I'm mistaken, I don't think Gilles is trying to create a "multi-document
window" interface like Xcode or Preview. It sounds like he wants a single
window with a single view (or set of related views) that simply displays the
contents of multiple files in aggregate.
If that understanding i
Eric,
It's possible that NSTextFinder has a bug, in which case you should file a
Radar with a sample app that reproduces the problem. Having that information,
it may be possible to identify a workaround.
However, first tell me—are you setting the endsWithSearchBoundary parameter to
YES for the
It overrides -[NSView hitTest:] to return self for clicks inside the draggable
region.
-KP
On Mar 26, 2012, at 10:30 AM, Markus Spoettl wrote:
> Hello all,
>
> does anyone know how to grab the cursor like NSSplitView does? It somehow
> manages to know that the cursor is near a divider when
The public NSTextFinder API doesn't provide a way for you to access the
old-style find panel.
-KP
On Mar 23, 2012, at 6:18 AM, Eric Slosser wrote:
> I'm trying to use the NSTextFinder object on Lion, from an app whose base SDK
> is Tiger.
>
> I've created an instance of NSTextFinder, called
Hi,
If your document class returns YES for +autosavesInPlace (which it hopefully
is!), then the dirty dot is no longer used.
The dot used to suggest that what was in memory differed from what's currently
on disk. With Lion's Autosave feature, the intent is to make it appear to the
user that wh
On Sep 30, 2011, at 8:47 AM, Kevin Perry wrote:
> On Sep 29, 2011, at 4:41 PM, Kyle Sluder wrote:
>
>> [...snip...]
>>
>> A general issue I have with asynchronous saving: what if the save
>> operation fails? The user has now made additional changes, but their
>
ve another question.
>
> On Thu, Sep 29, 2011 at 12:33 PM, Kevin Perry wrote:
>> NSDocument's NSFilePresenter methods use
>> performAsynchronousFileAccessUsingBlock: internally, so if something else
>> current has file access, the NSFileCoordinator requests are indee
On Sep 29, 2011, at 12:00 PM, Kyle Sluder wrote:
> On Thu, Sep 29, 2011 at 9:20 AM, Kevin Perry wrote:
>> If it were to call the fileAccessCompletionHandler any earlier then it might
>> be possible, for example, for -fileModificationDate to be invoked on the
>&
The header documentation for -performSynchronousFileAccessUsingBlock: (which
also applies to performAsynchronousFileAccessUsingBlock:) says:
"this method's primary use is to wait for asynchronous saving, but in
contrast with that method it is only for use to wait for the part of an
asyn
There's a bug in NSDocument in that it doesn't protect itself against nil
return values from -fileNameExtensionForType:saveOperation:. To work around,
make sure you return a non-nil value from that method.
-KP
On Sep 20, 2011, at 2:49 AM, Gerriet M. Denkmann wrote:
> In my toy editor I open an
Hi Graham,
Right now, Versions doesn't bring back the inspectors automatically, but it may
do so in the future. For now, bringing them back manually is the right thing.
As for the logging, it's a known OS bug, but is basically harmless.
Thanks.
On Aug 23, 2011, at 8:08 PM, Graham Cox wrote:
>
Whoops, found this too late. See my other reply about the actual cause of the
deadlock though.
Deprecation warnings are unfortunately only generated when calling a method,
not when they are overridden.
-KP
On Aug 22, 2011, at 8:24 PM, Graham Cox wrote:
>
> On 23/08/2011, at 1:00 PM, Graham C
Hi Graham,
First of all, -printShowingPrintPanel: is deprecated. I believe if you were to
stop overriding that method and use -printOperationWithSettings:error: and
-runModalPrintOperation:delegate:didRunSelector:contextInfo: instead the
problem would go away.
Otherwise, you've found the crux
Graham,
This can happen if there is a previous call to
-performActivityWithSynchronousWaiting:usingBlock: and the block never calls
the completion handler. If you use that method anywhere, please make sure the
completion handler always gets called. If you don't use the method directly,
other m
Ah, I did not foresee this.
I really can't generally recommend calling -saveToURL:::error: instead of
saveToURL:::completionHandler: because the latter does some important things
that the former doesn't. Unfortunately, I think the problem you're seeing with
the hang is insurmountable without ad
What Ken said.
Also, it might be more convenient to use NSBlockOperation or
-addOperationWithBlock so the function parameters (including the completion
handler) are all captured correctly for you automatically. It's a lot more
convenient than stashing things in an NSDictionary.
Finally, I miss
AppKit-initiated autosaves generally happen for two main reasons: the autosave
timer, and file coordination. These are both initiated with
-autosaveWithImplicitCancellability:completionHandler:. The "implicitly
cancelable" flag indicates whether it's appropriate for an NSDocument subclass
to ca
The Versions store will do this automatically. It can detect when blocks of a
file have been duplicated and avoid storing those blocks on disk.
On Jul 28, 2011, at 12:37 AM, Daniel Vollmer wrote:
> Salutations,
>
> in my custom document package I'm always including a large-ish chunk of data
>
There is nothing that you are obviously doing wrong here. Please file a Radar
with your test app attached.
-KP
On Jul 24, 2011, at 7:46 PM, Zorg wrote:
> I'm having a difficult time figuring out how to implement these features
> correctly in Lion. I've created a very simple NSDocument based te
On Jul 22, 2011, at 9:16 AM, Daniel Vollmer wrote:
> Hello,
>
> I'm trying to add autosavesInPlace support to my NSDocument-based
> Application. It supports a read-only type that is internally converted (as
> suggested in
> https://developer.apple.com/library/mac/documentation/Cocoa/Conceptua
Please check the NSData.h header and Foundation release notes for Lion.
Because mapping files on non-local drives (which may be disconnected or removed
at any moment, resulting in a crash if you attempt to access parts of the file
that haven't been faulted in) is unsafe, NSData on Lion has chang
This is a bug in the framework. NSError-returning methods should not need to
check the value of the dereferenced pointer before setting it.
Please file a bug for this.
-KP
On Mar 8, 2011, at 7:22 AM, Gerriet M. Denkmann wrote:
> I thought that NSError is just an output parameter, which is set
The reason why this isn't working in Leopard is simple: -setAlphaValue: for
non-layer-backed views was not implemented until Snow Leopard.
The documentation for -setAlphaValue: states:
> Sending this message to a view that is not managing a Core Animation layer
> causes an exception.
I don't
NSPathControl doesn't map submenus in its menu to the individual
NSPathComponentCells, so that's not going to work.
This will probably require some heavy subclassing of at least
NSPathComponentCell, and perhaps NSPathCell (if the layout isn't quite how you
need it). You'll need to provide some
?
>
> Dave
>
> On Jul 12, 2010, at 2:45 PM, Dave DeLong wrote:
>
>> Fair enough; How can I retrieve which item was clicked? The sender of the
>> action is the actual NSPathControl, and -clickedPathComponentCell:, which
>> works on 10.6, returns nil on 10.5.
Dave,
I believe what you're seeing is the intended behavior.
There are cases where developers have not wanted the URL to change when an item
in the pop-up menu is selected. Instead of doing this automatically and forcing
developers to prevent or undo this behavior, NSPathControl instead expects
You can use the C API in /usr/include/NSSystemDirectories.h.
On Jul 12, 2010, at 1:17 PM, Alexander Cohen wrote:
> Hello,
>
> I need to find the system Application Support folder without using either
> Carbon or Cocoa, i can use CoreFoundation though. Is there a way to do this?
>
> thx
>
> AC
That documentation is incorrect and is scheduled to be corrected.
-attribtuesOfItemAtPath:error: will never automatically resolve symlinks, and
that will never change.
-Kevin Perry
On May 28, 2010, at 8:17 AM, Charles Srstka wrote:
> On May 28, 2010, at 10:01 AM, Tito Ciuro wrote:
>
It's referring to the source path. The documentation specifically states that
no file should exist at the destination path. So, one can deduce that
NSFileManager wouldn't report a "no such file" error if there was no file
there, since that is what is expected.
-Kevin
On Apr 13, 2010, at 11:31
use an NSCollectionView. I was thinking the collection view would save me
> some work. Appears to not be the case.
>
> Thanks for the assistance.
>
> Brian
>
> - Original Message -
> From: "Kevin Perry"
> To: "Brian Krisler"
> Cc: cocoa-dev@lis
I'm not sure this is really a usage case that I'd expect to be well tested,
since it seems a little out of the ordinary.
Anyway, which approach are you using for your prototype view? Is the view in
the same nib, or have you factored it out into a separate nib, using the fact
that NSCollectionVi
In general, this kind of check-then-do pattern opens the door for file system
race conditions. The documentation for this method (and related methods) has a
little more information about this in the "Note" section.
Could you just try to copy the symlink and then deal with any errors that
result
65 matches
Mail list logo