UIDocument's fileType reports wrong UTI.
Hello, In an iOS project, that is supposed to handle different kind of files, I declared in Info.plist the types handled, with two UTI types, say com.mycompany.typeA and com.mycompany.typeB. I also added the expected filename extensions for the two, suppose it's .typeA and .typeB. Now, I instantiate my UIDocument, with the following code: (all inspired by UIKit docs, I stripped off some details for the sake of lisibility, the file is guaranteed not to exist in the app folder.) NSString *newDocumentPath = [ AppDocumentPath() stringByAppendingPathComponent: @NewDocument.typeA ]; // Gives me a valid path to AppHome/Documents/NewDocument.typeA NSURL *newDocumentURL = [ NSURL fileURLWithPath: newDocumentPath ]; // Creates a file:// for that path. MyDocument *newDocument = [ [ MyDocument alloc ] initWithFileURL: newDocumentURL ]; // Instantiates the doc // Finally present. [ newDocument saveToURL: newDocumentURL forSaveOperation: UIDocumentSaveForCreating completionHandler: ^(BOOL success) { [ self presentViewController: newDocument.viewController animated: YES completion: ^(){} ]; } ]; There, in the process of saving, in UIDocument's - (id)contentsForType:(NSString *)typeName error:(NSError **)outError typeName is dyn.age81u5dmr3wu, not conforming to UTI for typeA or typeB. The url is correct. At any other point in the execution, fileType reports the wrong type. With a colleague, we tried on another app where it wasn't checked for since it handles only one file format, and it's exactly the same, fileType returns another UTI from the one declared in the Info.plist. All of this under iOS7. ___ 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: UIDocument's fileType reports wrong UTI.
Here's the Info.plist section keyCFBundleDocumentTypes/key array dict keyCFBundleTypeExtensions/key array stringtypeA/string /array keyCFBundleTypeIconFiles/key array/ keyCFBundleTypeName/key stringDocument Type A/string keyLSItemContentTypes/key array stringcom.mycompany.typeA/string /array /dict dict keyCFBundleTypeExtensions/key array stringtypeB/string /array keyCFBundleTypeIconFiles/key array/ keyCFBundleTypeName/key stringDocument Type B/string keyLSItemContentTypes/key array stringcom.mycompany.typeB/string /array /dict /array On Oct 23, 2013, at 3:10 PM, Mike Abdullah mabdul...@karelia.com wrote: On 23 Oct 2013, at 13:08, Half Activist halfactiv...@gmail.com wrote: Hello, In an iOS project, that is supposed to handle different kind of files, I declared in Info.plist the types handled, with two UTI types, say com.mycompany.typeA and com.mycompany.typeB. I also added the expected filename extensions for the two, suppose it's .typeA and .typeB. Now, I instantiate my UIDocument, with the following code: (all inspired by UIKit docs, I stripped off some details for the sake of lisibility, the file is guaranteed not to exist in the app folder.) NSString *newDocumentPath = [ AppDocumentPath() stringByAppendingPathComponent: @NewDocument.typeA ]; // Gives me a valid path to AppHome/Documents/NewDocument.typeA NSURL *newDocumentURL = [ NSURL fileURLWithPath: newDocumentPath ]; // Creates a file:// for that path. MyDocument *newDocument = [ [ MyDocument alloc ] initWithFileURL: newDocumentURL ]; // Instantiates the doc // Finally present. [ newDocument saveToURL: newDocumentURL forSaveOperation: UIDocumentSaveForCreating completionHandler: ^(BOOL success) { [ self presentViewController: newDocument.viewController animated: YES completion: ^(){} ]; } ]; There, in the process of saving, in UIDocument's - (id)contentsForType:(NSString *)typeName error:(NSError **)outError typeName is dyn.age81u5dmr3wu, not conforming to UTI for typeA or typeB. The url is correct. At any other point in the execution, fileType reports the wrong type. With a colleague, we tried on another app where it wasn't checked for since it handles only one file format, and it's exactly the same, fileType returns another UTI from the one declared in the Info.plist. All of this under iOS7. Show us the relevant portion of your Info.plist file too, please. ___ 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: UIDocument's fileType reports wrong UTI.
Sorry, here is the exported type section. keyUTExportedTypeDeclarations/key array dict keyUTTypeConformsTo/key array stringpublic.xml/string /array keyUTTypeDescription/key stringType A/string keyUTTypeIdentifier/key stringcom.mycompany.typeA/string /dict dict keyUTTypeConformsTo/key array stringpublic.xml/string /array keyUTTypeDescription/key stringtypeB/string keyUTTypeIdentifier/key stringcom.mycompany.typeB/string /dict /array As for the fake info, I don't know the exact extent of the secrecy i'm supposed to have concerning my work, therefore I replaced with typeA and typeB, which in any case changes the meaning of the it. I could have replaced with .png and .jpg and put some realistic UTI for them, would it appear fake? No? Yet it would have been as much. On Oct 23, 2013, at 5:20 PM, Kyle Sluder k...@ksluder.com wrote: On Oct 23, 2013, at 6:17 AM, Half Activist halfactiv...@gmail.com wrote: Here's the Info.plist section keyCFBundleDocumentTypes/key array dict keyCFBundleTypeExtensions/key array stringtypeA/string /array keyCFBundleTypeIconFiles/key array/ keyCFBundleTypeName/key stringDocument Type A/string keyLSItemContentTypes/key array stringcom.mycompany.typeA/string /array /dict dict keyCFBundleTypeExtensions/key array stringtypeB/string /array keyCFBundleTypeIconFiles/key array/ keyCFBundleTypeName/key stringDocument Type B/string keyLSItemContentTypes/key array stringcom.mycompany.typeB/string /array /dict /array 1. Fake info is not useful. Real info only. 2. You left out the most important part—your actual UTI declarations (UTExportedTypeDeclarations). --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: Fastest way to do screen captures on OSX ?
Definitely not using CGWindowListCreateImage. In the past, inspired by some code, i wrote a screen capture test program using opengl, the trick was to declare a fullscreen context without a curtain window or setting it to transparent and then reading the pixels, and that was quite fast, on a G4 i could achieve hundreds (or thousands?) of FPS (which is completely useless i agree on a 60Hz display). The problem is, since 10.7 (?) this stopped working, all the pixels you read are black. In the meantime, quicktime was added screen capture support and something was added to AVFoundation, and you can directly capture the screen using it, I personally never used it. https://developer.apple.com/library/mac/qa/qa1740/_index.html Regards. On Oct 16, 2013, at 7:26 AM, cocoa-dev-requ...@lists.apple.com wrote: Date: Wed, 09 Oct 2013 23:16:49 -0400 From: Mauritz Jameson mjames2...@gmail.com To: cocoa-dev@lists.apple.com Subject: Fastest way to do screen captures on OSX ? Message-ID: cahff3y-euqrfnb0rsxujxs6rshz99o+ielqgcyndr1wgnjn...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 I have created a function to do screen captures on OSX. Since I'm new to OSX, Xcode and the SDKs on OSX, I've asked for a code review of the screen capture function here: http://codereview.stackexchange.com/questions/32466/reviewing-c-function-which-captures-the-screen The function is a bit messy since it's a prototype. I would be very happy if you could tell me how I can optimize the code I've posted in the link above. The screen capture function is being called every 100ms approximately and these frequent function calls seems to slow everything else down. After my program has run for a little while, the desktop and mouse pointer becomes very laggy/non-responsive. The mouse pointer icon periodically changes to that spinning circle (equivalent to the hour glass on Windows). Opening other apps while my program is running is also a problem. After my program has run for 30 seconds or so, opening up a browser takes more than a minute. Eventually everything just hangs and I have to reboot. I'm wondering if it's the screen capture method itself (i.e. using the Core Graphics API) which isn't ideal for this type of application or if there's something in the screen capture code which is causing the above mentioned problems. If I comment out the code in the screen capture function and run my program, I don't get the same laggy behavior. So the bottleneck/problem definitely seems to have something to do with the way I capture the screen. Any suggestions, comments, questions etc. are highly appreciated. Thank you!! ___ 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 test whether Mac app is running in Xcode?
I'd suggest you give a look at getppid(), and try to retrieve the parent's path using sysctl with KERN_PROCARGS2. For more info try google: sysctl KERN_PROCARGS2. Regards. On Oct 15, 2013, at 1:12 PM, cocoa-dev-requ...@lists.apple.com wrote: Date: Tue, 15 Oct 2013 07:12:11 -0400 From: Bill Cheeseman wjcheese...@gmail.com To: Cocoa-Dev Cocoa-Dev Mail cocoa-dev@lists.apple.com Subject: How test whether Mac app is running in Xcode? Is there any way to test whether an application is running in Xcode or some other compiler/debugger, and not as a free-standing application? And then to get the name of the compiler/debugger? I'm currently testing #ifdef DEBUG and simply assuming that Xcode is the only compiler/debugger available on the Mac. But I understand that isn't true. -- Bill Cheeseman ___ 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
UINavigationController subclass won't load its nib.
Hi, To put it shortly, my UINavigationController doesn't load its assigned NIB at all. I've got an UINavigationController subclass that contains the code for an object inspector in an app i'm writing. It's declared as the file's owner of a nib of the same name, this nib helps me build the ui of the various subviews pushed as details of some parameter, selected on a root table view. (ie a somewhat classical way for an inspector on ios). Now, I instantiate my view controller with: [ [ MyNavController alloc ] initWithNibName: @MyNavController bundle: nil ]; And display it in a popover. The popover remains empty. loadView is called but it doesnt not contain the root view assigned in IB. None of my outlets are populated, I overloaded some setters, they aren't called at all. All other objects aren't instantiated by the way... ...Therefore I guess the NIB isn't even loaded! To rule out a potential resource loading error, I wrote a nib loading method of mine using UINib. And it works, the NIB is correct, everything is correct. Except that UINavigationController doesn't want to load its assigned NIB. Regards. ___ 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: Cocoa-dev Digest, Vol 10, Issue 633
Thanks Jerry. I don't know how i went by the documentation and didn't see this method :S As for the size of the window, the view is somewhat mangled with buttons overlapping at this size. Yet the user can review its data in versions. Regards. On Oct 3, 2013, at 7:59 PM, cocoa-dev-requ...@lists.apple.com wrote: Date: Thu, 03 Oct 2013 06:27:35 -0700 From: Jerry Krinock je...@ieee.org To: Cocoa Developers cocoa-dev@lists.apple.com Subject: Re: Window too large for Versions Browser Message-ID: e248f4e2-9edd-464a-93dc-49525d473...@ieee.org Content-Type: text/plain; charset=us-ascii On 2013 Oct 03, at 00:12, Half Activist halfactiv...@gmail.com wrote: Well, the minSize is actually correctly set but that doesn't seem to be small enough for Versions on small desktops, I found a solution by implemeting the NSWindowDelegate methods below to set the minSize to 640x480 when entering Versions, and setting it back to 1200x680 when exiting. I think that you need to give this more thought. First of all, the intended method where you should resize your window for the versions browser is -window:willResizeForVersionBrowserWithMaxPreferredSize:maxAllowedSize: is , not -windowWillEnterVersionBrowser: If you used that method, then you will get an allowed size which is commensurate with the current display resolution, and would not need to hard-code it to the minimum known size, which could get smaller if, for example, Apple someday decides to put OS X on an iPad or iWatch :)) And then there is the issue of how your app works normally on small screens, with a minSize of {1200, 680} for that window. Finally, that minSize is supposed to be the absolute minimum that works. If you can change it from {1200, 680} down to {640, 840}, then {1200, 680} was not really a minimum! And, out of curiosity, I assume you are testing this with your display resolution set to some very small value? And it works OK without those delegate method implementations if you test it with larger display resolution? ___ 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: Re: Window too large for Versions Browser
Well, the minSize is actually correctly set but that doesn't seem to be small enough for Versions on small desktops, I found a solution by implemeting the NSWindowDelegate methods below to set the minSize to 640x480 when entering Versions, and setting it back to 1200x680 when exiting. - (void)windowWillEnterVersionBrowser:(NSNotification *)notification { if( notification.object == self.mainWindow ){ self.mainWindow.minSize = NSMakeSize( 640, 480 ); } } - (void)windowWillExitVersionBrowser:(NSNotification *)notification { if( notification.object == self.mainWindow ){ self.mainWindow.minSize = NSMakeSize( 1200, 680 ); } } On Oct 2, 2013, at 7:56 PM, cocoa-dev-requ...@lists.apple.com wrote: On 2013 Oct 02, at 06:56, Half Activist halfactiv...@gmail.com wrote: 'NSInvalidArgumentException', reason: '*** -[NSDocumentRevisionsView layoutWithOriginalDocumentWindow:originalVisibleFrame:]: Window () cannot be used to browse versions because its minimum size ({1200, 701}) is too large.' …I've tried to solve it by setting the minimum width to 800… The first thing you should do is to break on that exception (hopefully All Objective-C Exceptions will work), ask your window for its -minSize and -contentMinSize, and verify that your setting to 800 is being effective. Let us know if that does not lead to a solution. ___ 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
Window too large for Versions Browser
Hi, In a NSDocument based application, which mainWindow minSize is set to 1200x600, when entering the Versions browser, the application crashes after being notified that the window is too large and couldn't be resized on small screens. I've tried to solve it by setting the minimum width to 800, yet the same exception is being thrown and the app crashes. Thanks. Logged exception: 'NSInvalidArgumentException', reason: '*** -[NSDocumentRevisionsView layoutWithOriginalDocumentWindow:originalVisibleFrame:]: Window () cannot be used to browse versions because its minimum size ({1200, 701}) is too large.' ___ 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
NSDatePickerCell in TableView/OutlineView
Hi, I'm starting using a nsdatepickercell in an outlineview, but cannot edit the values. The column is editable though, and my delegate returns YES for outlineView:(NSOutlineView *)outlineView shouldEditTableColumn:(NSTableColumn *)tableColumn item:(id)item. I've read NSdatePickerCell was not editable back in Tiger's days, but is it editable in Snow Leopard Lion? Thanks in advance. ___ 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
Drag Drop/Pasteboard issue in Lion
Hello, I'm working on a project where i can drag items from the Address Book (persons) and drop them on a view to add them (actually read the vCard). Everything worked fine up to Lion. Now, the pasteboard gives me the type public.vcard as available, but no data is available for it yet (NSPasteboardItem dataForType: returns nil). I tried getting the data as a propertyList and string but the results are coherent, nothing is stored in the pasteboard. I gave a look at the file promise, the type com.apple.pasteboard.promised-file-url is available, but nil is returned with dataForType:, propertyListForType: and stringForType:. Any hints are welcome. Regards.___ 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
Nested NSCollectionView scroll weirdness
Hello all, I'm having kind of troubles with embedded collection views. I'm displaying a list of items vertically, each of these items may have subitems i list in another collection view, this time horizontally. Everything fine so far, the NSCollectionViewItems get loaded well, for both the parent list and the child lists. Now, a sublist's too long to be displayed, the horizontal scroller appears but scrolling won't do anything on this sublist. I subclassed NSScroller + NSScrollView and stepped the code, and all I can tell to this point, is that the embedded scrollview receives events (especially the scrollWheel: message), but, it does nothing. The document rect is desperatly the same. I tried to put an NSTextView instead of the nested collectionview and the same behaviour is shown. So i don't even know whether it's a scrollview or collection view issue. I'd be ready to write a hand made collectionview if i was sure i won't get the same problem because of embedded scrollviews. Thanks in advance. ___ 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: NSDocument save as bug
Not at all! The bug comes from the fact that it is called twice, first when the document's nib is loaded (and everything is ok) and secondly when the panel opens in which case yes it crashes becaus e initialization already took place and it shouldn't be called however. regards. On Feb 1, 2010, at 8:54 AM, Alexey Zakhlestin wrote: On 01.02.2010, at 10:13, Half Activist wrote: Hello, In a NSDocument based application, my document class handles 3 different kinds of documents, 1 as a viewer and 2 as an editor. Actually, I wished it could handle the 2 types as an editor but here is what happens: When I only have 1 type everything is ok as you might already have understood, but when I add the second type and I go into Save As... the app crashes under Snow Leopard. It all boils down to the point that this little popup that's added to the panel to select the file type seems to be screwing everything up. What's happening: my document class awakeFromNib gets called when the save panel is loaded, I pasted the callstrack below: #0 -[MyProjectDocument awakeFromNib] (self=0x100436c60, _cmd=0x7fff830614e0) at /Users/devel/Work/Project/MyProjectDocument.m:371 this line clearly shows, that the bug is in your awakeFromNib method at line 371. you should apply fix there #1 0x7fff82927959 in -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] () #2 0x7fff82925b49 in loadNib () #3 0x7fff8292525c in +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] () #4 0x7fff82c93797 in -[NSDocument _savePanelAccessoryViewForWritableTypes:defaultType:] () #5 0x7fff82c91192 in -[NSDocument _preparedSavePanelForOperation:] () #6 0x7fff82c9022b in -[NSDocument _runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo:] () #7 0x7fff82c8dcda in -[NSDocument runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo:] () #8 0x7fff82ab909a in -[NSApplication sendAction:to:from:] () #9 0x7fff82add602 in -[NSMenuItem _corePerformAction] () #10 0x7fff82add36c in -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] () #11 0x7fff82d600b8 in -[NSMenu _internalPerformActionForItemAtIndex:] () #12 0x7fff82c129d5 in -[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:] () #13 0x7fff82abfb60 in NSSLMMenuEventHandler () #14 0x7fff83e48bd7 in DispatchEventToHandlers () #15 0x7fff83e48126 in SendEventToEventTargetInternal () #16 0x7fff83e65d49 in SendEventToEventTarget () #17 0x7fff83e94d45 in SendHICommandEvent () #18 0x7fff83ec1a1a in SendMenuCommandWithContextAndModifiers () #19 0x7fff83ec19d4 in SendMenuItemSelectedEvent () #20 0x7fff83ec18dc in FinishMenuSelection () #21 0x7fff83ea2cf9 in MenuSelectCore () #22 0x7fff83ea2461 in _HandleMenuSelection2 () #23 0x7fff82990b79 in _NSHandleCarbonMenuEvent () #24 0x7fff829646a2 in _DPSNextEvent () #25 0x7fff82963b41 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] () #26 0x7fff82929747 in -[NSApplication run] () #27 0x7fff82922468 in NSApplicationMain () #28 0x0001172d in main (argc=1, argv=0x7fff5fbff7c0) at /Users/devel/Work/Project/main.m:15 Maybe should I report this bug to Apple? Regards.___ 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/indeyets%40gmail.com This email sent to indey...@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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSDocument save as bug
I'm not making any assumption on the number of documents that might exist at one time. Even if i have 10 documents opened, the one that i do a save as on has its _instance method_ awakeFromNib called a second time: The callstack shows that my document's awakeFromNib is being called during the save panel setup process. #1 0x7fff82927959 in -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] () #2 0x7fff82925b49 in loadNib () #3 0x7fff8292525c in +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] () #4 0x7fff82c93797 in -[NSDocument _savePanelAccessoryViewForWritableTypes:defaultType:] () #5 0x7fff82c91192 in -[NSDocument _preparedSavePanelForOperation:] () #6 0x7fff82c9022b in -[NSDocument _runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo:] () Unless specifying several editable document types grants your awakeFromNib an undocumented chance to get called a second time. Furthermore, how do you explain that this works on Leopard but fails on Snow Leopard?___ 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: NSDocument save as bug
Hi Kyle, the problem is my save panel doesn't have an accessory view :S Regards. On Feb 1, 2010, at 6:28 PM, Kyle Sluder wrote: On Mon, Feb 1, 2010 at 9:16 AM, Half Activist halfactiv...@gmail.com wrote: Even if i have 10 documents opened, the one that i do a save as on has its _instance method_ awakeFromNib called a second time: Are you sure it's the same instance? It really looks like you have accidentally added an NSDocument instance to your accessory view nib. --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: NSDocument save as bug
Hi Gregory, thanks for your support, I was a bit upset because I'm pretty sure the same instance fails. Because when the crashes began to happen after adding the second document type, I put a breakpoint in awakeFromNib, and by giving a look at the document, I knew that this was a document already opened everything in it was valid. But to be really certain of it I added a simple awakeFromNibAlreadyCalled instance variable, and it showed that this one instance had its awakeFromNib method called a second time. PS: I put a breakpoint and dumped self with gdb. The first time it is called: (gdb) print (void *) self $1 = (void *) 0x100675c30 The second time: (gdb) print (void *) self $2 = (void *) 0x100675c30 Regards. On Feb 1, 2010, at 7:55 PM, Gregory Weston wrote: On Feb 1, 2010, at 12:16 PM, Half Activist wrote: I'm not making any assumption on the number of documents that might exist at one time. Even if i have 10 documents opened, the one that i do a save as on has its _instance method_ awakeFromNib called a second time: The callstack shows that my document's awakeFromNib is being called during the save panel setup process. Yes. The call stack shows that awakeFromNib is being sent to *an* instance of your document class. The call stack also shows just before that that a nib is being loaded and the objects therein instantiated. If that's not what's implied by lines 1-3, someone at NeXT did a mind-bogglingly horrible job coming up with method names. #1 0x7fff82927959 in -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] () #2 0x7fff82925b49 in loadNib () #3 0x7fff8292525c in +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] () #4 0x7fff82c93797 in -[NSDocument _savePanelAccessoryViewForWritableTypes:defaultType:] () #5 0x7fff82c91192 in -[NSDocument _preparedSavePanelForOperation:] () #6 0x7fff82c9022b in -[NSDocument _runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo:] () Unless specifying several editable document types grants your awakeFromNib an undocumented chance to get called a second time. Furthermore, how do you explain that this works on Leopard but fails on Snow Leopard? One possible explanation is that Snow Leopard is using a technique to populate the formats menu that involves instantiating your document(s) while Leopard used a different technique. Regardless of the nothing new marketing line that was used for 10.6, behind the scenes we know quite a lot changed. ___ 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
NSDocument save as bug
Hello, In a NSDocument based application, my document class handles 3 different kinds of documents, 1 as a viewer and 2 as an editor. Actually, I wished it could handle the 2 types as an editor but here is what happens: When I only have 1 type everything is ok as you might already have understood, but when I add the second type and I go into Save As... the app crashes under Snow Leopard. It all boils down to the point that this little popup that's added to the panel to select the file type seems to be screwing everything up. What's happening: my document class awakeFromNib gets called when the save panel is loaded, I pasted the callstrack below: #0 -[MyProjectDocument awakeFromNib] (self=0x100436c60, _cmd=0x7fff830614e0) at /Users/devel/Work/Project/MyProjectDocument.m:371 #1 0x7fff82927959 in -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] () #2 0x7fff82925b49 in loadNib () #3 0x7fff8292525c in +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] () #4 0x7fff82c93797 in -[NSDocument _savePanelAccessoryViewForWritableTypes:defaultType:] () #5 0x7fff82c91192 in -[NSDocument _preparedSavePanelForOperation:] () #6 0x7fff82c9022b in -[NSDocument _runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo:] () #7 0x7fff82c8dcda in -[NSDocument runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo:] () #8 0x7fff82ab909a in -[NSApplication sendAction:to:from:] () #9 0x7fff82add602 in -[NSMenuItem _corePerformAction] () #10 0x7fff82add36c in -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] () #11 0x7fff82d600b8 in -[NSMenu _internalPerformActionForItemAtIndex:] () #12 0x7fff82c129d5 in -[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:] () #13 0x7fff82abfb60 in NSSLMMenuEventHandler () #14 0x7fff83e48bd7 in DispatchEventToHandlers () #15 0x7fff83e48126 in SendEventToEventTargetInternal () #16 0x7fff83e65d49 in SendEventToEventTarget () #17 0x7fff83e94d45 in SendHICommandEvent () #18 0x7fff83ec1a1a in SendMenuCommandWithContextAndModifiers () #19 0x7fff83ec19d4 in SendMenuItemSelectedEvent () #20 0x7fff83ec18dc in FinishMenuSelection () #21 0x7fff83ea2cf9 in MenuSelectCore () #22 0x7fff83ea2461 in _HandleMenuSelection2 () #23 0x7fff82990b79 in _NSHandleCarbonMenuEvent () #24 0x7fff829646a2 in _DPSNextEvent () #25 0x7fff82963b41 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] () #26 0x7fff82929747 in -[NSApplication run] () #27 0x7fff82922468 in NSApplicationMain () #28 0x0001172d in main (argc=1, argv=0x7fff5fbff7c0) at /Users/devel/Work/Project/main.m:15 Maybe should I report this bug to Apple? Regards.___ 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
NSSavePanel crash!
Hello All, I'm developping a document-based application that up to today could read two document types and write one of the two. So one type was set as an editor the other one as viewer in the Info.plist. All the save/open panel stuff is the plain AppKit behavior and I haven't overridden a tiny ounce of it all in my NSDocument subclass. Today I added a new editor document type in the info.plist. Gave it a name, an icon, an extension, etc and set the app as an editor of this type. Now I open a document, choose File Save As, the save panel appears and bang, crash! So i traced it back and my own document's awakeFromNib is being called by the savepanel opening process! That's _really_ weird. If anyone already experienced this, did I do something wrong (clearly I don't think so because I haven't even changed the source code, except for one test)? Yes the weirdest thing is that my code hasn't changed! Regards.___ 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 cross dependencies
Hi all, I have sevral objects of different kind that observe values on each other. Now, when the objects are being released, I get an exception from the KVO stuff telling me that an object is being deallocated while still observed. And that's justified. Yet, the problem is in whatever way, order I deallocate the objects that will always happen because of these cross observations. Therefore what I should do is tell everyone that's observing an object to remove them as observers. But how can I get a list of all observed keys and the observers? Regards. PS: I thought about setting the observation info to nil but I guess this is a one way ticket to a segfault. ___ 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
NSCollectionView issues
Hi, I'm using a NSCollectionView to display a stack of items (a table) but since what's display is far too complex to be laid out programmatically I went for the NSCollectionView. And it's been all problems from the beginning. First of all with setContent that never worked no matter what I did...it only works if I bind the content to an nsarraycontroller. Now, when I add a new item in this table i want to be able to scroll it to the displayed area of the view, but the frameForItemAtIndex: method only appeared in 10.6, so I decided to use the subviews and get the frame this way, and now what did I discover: Suppose I have N items and therefore N subviews in the NSCollectionView, after changing the array that now contains N + 1 items, the nscollectionview has after the update N + N + 1 subviews! So, accessing subviews is not an option either. If anyone knows how to do fix these bugs, and how to disable the animation, i'd be really glad. I'm considering writing an homebrew nscollectionview. regards. ___ 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
Retain cycles with NIB instantiations, bindings
Hi, I'm loading a NIB file at runtime and use a new instance of a class as its owner each time. Everything works fine, until I wish to delete an object. In my software, i'm using several instances of objects that have their own UI but are all part of kind of project, a controller/ manager entity. So each time I create a new backend object, I tie an UI to it, loaded with a NIB file and use bindings to the object to handle UI updates. Now when I delete the object from my controller, it doesn't get dealloc'd since the bindings in the NIB retain it. Do you know of a way to proceed other than creating a notification/ callback trigerred at the deletion of the object from the manager that would destroy the UI and therefore break this retain loop? Regards. ___ 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
Spaces: Receiving a space change notification.
Hello everyone, Is it possible to receive a notification when the active space changes? Or is it possible to programatically make an application display on all spaces? h.a. ___ 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
Changing the default audio output hardware
Hi, Does anybody know how to change the system's default sound output programatically speaking of course ;-) Regards. ___ 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 [EMAIL PROTECTED]
is LSEnvironment working with Leopard?
Hello everyone, The subject sums it up: Is the LSEnvironment plist key still supported in Leopard? I've been trying to set an environment variable this way with no luck. I've read about the /var/db/.AllowDYLDEnvironmentVariables trick, and thought it might enable LSEnvironment, but didn't work either. I know about ~/.MacOSX/environment.plist but didn't want to add a global environment variable. Does anybody know if there are other possibilities? Regards. ___ 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 [EMAIL PROTECTED]