Does the NSPersistentContainer name mean anything?
For the one-argument initializer, the name is used to figure out where the model file is. But I’m using the two-argument initializer, where I already give the model file’s location (because it’s in my framework’s bundle). Can I just put any random thing there (even an empty string), or is the name still relevant? — Daryle Walker Mac, Internet, and Video Game Junkie darylew AT mac DOT 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: Sometimes all my menus are disabled
Have you tried printing the responder chain when this happens? But as others have said, funnelling all menu choices through a menuClick: method sounds backwards. On 12 Feb 2017, at 18:01, Andreas Falkenhahn wrote: > I'm experiencing a strange issue with my app. Sometimes, maybe in 1 out of 10 > programs starts, all menus of my app are grayed out, including standard menus > like "Services", "Hide XXX", "Hide Others", "Show All", "Minimize", "Zoom", > "Bring All To Front", really everything is grayed out right after my app has > launched! > > I don't really know what to do about this because I don't have any actual code > in my app that relates to menus. The menu is created in Interface Builder and > the individual items are connected to "AppDelegate menuClick:" in the > "Sent Actions" part of Xcode. That's pretty much all I have. > > What could be the problem here? How can I find out what's going awry here? > > As I said, in 9 of 10 attempts everything works fine, but in maybe 1 of 10 > attempts all menus are grayed out right after my app has launched, making it > impossible to use my app :-( > > -- > Best regards, > Andreas Falkenhahn mailto:andr...@falkenhahn.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
Is it OK to use the default initializer of NSPersistentStoreDescription?
When I was typing in a test object of type NSPersistentStoreDescription (on Xcode 8 with Swift 3), the auto-complete gave me two initializers. Besides the documented one that takes a URL, there’s one that takes no arguments. Its own notes say it’s for subclasses. I, however, am describing an in-memory store, which doesn’t need a URL (as far as I know). Is this an official way to start declaring a NSPersistentStoreDescription (for in-memory stores)? Or should I put in a junk URL in the publicized initializer then set the field to NIL? — Daryle Walker Mac, Internet, and Video Game Junkie darylew AT mac DOT 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: Sometimes all my menus are disabled
Another possibility is that the target (app delegate) overrides -validateMenuItem: and isn’t doing the right thing. —Graham > On 13 Feb 2017, at 7:55 AM, Kyle Sluder wrote: > >>> >>> On Feb 12, 2017, at 12:36 PM, Andreas Falkenhahn >>> wrote: >> >> >>> On 12.02.2017 at 21:29 Kyle Sluder wrote: >>> >>> You’ve wired up every single menu item to a single action in your app >>> delegate? That’s certainly non-standard. >> >> It's really old code. It's an Xcode project I originally created on a >> PowerPC Mac some 10 years ago, so I don't really remember how I used >> Interface Builder back then. All I see is that every single menu item >> has an entry under "Sent Actions" that links to "AppDelegate: menuClick". >> The menu events are then processed in the "menuClick" method of my >> app delegate. >> >>> By default, menus automatically enable/disable their items based on >>> whether the target can perform the action. Perhaps your app delegate is >>> being deallocated, and thus the menu is walking the responder chain and >>> failing to find a responder that responds to -menuClick:? >> >> But how can that possibly happen? I'm certainly not deallocating the >> app delegate myself... > > There are plenty of ways to write refcounting bugs. But the refcounting bug > is just a theory. All we know for sure is that something is disabling the > menu items. I assume you have not turned off the default autoenablesItems > property on the menu, so that leaves a few possibilities: > > 1. The target of your menu items is being replaced with an object that does > not respond to -menuClick:. > 2. The target of your menu items is being deallocated, and a new object is > being allocated in its place that does not respond to -menuClick:. > 3. The target of your menu items is being deallocated, and NSMenuItem’s weak > target pointer is being nilled out (special case of #1). > 4. The menu has a delegate, and it implements of one of the menu update > callbacks to disable the menu items. > 5. Some arbitrary object in your app is grabbing a reference to the menu > items and disabling them. > > --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: Sometimes all my menus are disabled
>> On Feb 12, 2017, at 12:36 PM, Andreas Falkenhahn >> wrote: > > >> On 12.02.2017 at 21:29 Kyle Sluder wrote: >> >> You’ve wired up every single menu item to a single action in your app >> delegate? That’s certainly non-standard. > > It's really old code. It's an Xcode project I originally created on a > PowerPC Mac some 10 years ago, so I don't really remember how I used > Interface Builder back then. All I see is that every single menu item > has an entry under "Sent Actions" that links to "AppDelegate: menuClick". > The menu events are then processed in the "menuClick" method of my > app delegate. > >> By default, menus automatically enable/disable their items based on >> whether the target can perform the action. Perhaps your app delegate is >> being deallocated, and thus the menu is walking the responder chain and >> failing to find a responder that responds to -menuClick:? > > But how can that possibly happen? I'm certainly not deallocating the > app delegate myself... There are plenty of ways to write refcounting bugs. But the refcounting bug is just a theory. All we know for sure is that something is disabling the menu items. I assume you have not turned off the default autoenablesItems property on the menu, so that leaves a few possibilities: 1. The target of your menu items is being replaced with an object that does not respond to -menuClick:. 2. The target of your menu items is being deallocated, and a new object is being allocated in its place that does not respond to -menuClick:. 3. The target of your menu items is being deallocated, and NSMenuItem’s weak target pointer is being nilled out (special case of #1). 4. The menu has a delegate, and it implements of one of the menu update callbacks to disable the menu items. 5. Some arbitrary object in your app is grabbing a reference to the menu items and disabling them. --Kyle Sluder > > -- > Best regards, > Andreas Falkenhahnmailto:andr...@falkenhahn.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: Sometimes all my menus are disabled
On 12.02.2017 at 21:29 Kyle Sluder wrote: > You’ve wired up every single menu item to a single action in your app > delegate? That’s certainly non-standard. It's really old code. It's an Xcode project I originally created on a PowerPC Mac some 10 years ago, so I don't really remember how I used Interface Builder back then. All I see is that every single menu item has an entry under "Sent Actions" that links to "AppDelegate: menuClick". The menu events are then processed in the "menuClick" method of my app delegate. > By default, menus automatically enable/disable their items based on > whether the target can perform the action. Perhaps your app delegate is > being deallocated, and thus the menu is walking the responder chain and > failing to find a responder that responds to -menuClick:? But how can that possibly happen? I'm certainly not deallocating the app delegate myself... -- Best regards, Andreas Falkenhahnmailto:andr...@falkenhahn.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: Sometimes all my menus are disabled
On 12.02.2017 at 20:44 Alexander Reichstadt wrote: > Do you subclass NSApplication or alter the responder chain? No, not doing any of that. -- Best regards, Andreas Falkenhahnmailto:andr...@falkenhahn.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: Sometimes all my menus are disabled
On Sun, Feb 12, 2017, at 11:01 AM, Andreas Falkenhahn wrote: > I'm experiencing a strange issue with my app. Sometimes, maybe in 1 out > of 10 > programs starts, all menus of my app are grayed out, including standard > menus > like "Services", "Hide XXX", "Hide Others", "Show All", "Minimize", > "Zoom", > "Bring All To Front", really everything is grayed out right after my app > has > launched! > > I don't really know what to do about this because I don't have any actual > code > in my app that relates to menus. The menu is created in Interface Builder > and > the individual items are connected to "AppDelegate menuClick:" in the > "Sent Actions" part of Xcode. That's pretty much all I have. You’ve wired up every single menu item to a single action in your app delegate? That’s certainly non-standard. By default, menus automatically enable/disable their items based on whether the target can perform the action. Perhaps your app delegate is being deallocated, and thus the menu is walking the responder chain and failing to find a responder that responds to -menuClick:? --Kyle Sluder > > What could be the problem here? How can I find out what's going awry > here? > > As I said, in 9 of 10 attempts everything works fine, but in maybe 1 of > 10 > attempts all menus are grayed out right after my app has launched, making > it > impossible to use my app :-( > > -- > Best regards, > Andreas Falkenhahn > mailto:andr...@falkenhahn.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: Sometimes all my menus are disabled
On 12.02.2017 at 19:21 Ken Thomases wrote: > On Feb 12, 2017, at 11:01 AM, Andreas Falkenhahn > wrote: >> I'm experiencing a strange issue with my app. Sometimes, maybe in 1 out of 10 >> programs starts, all menus of my app are grayed out, including standard menus >> like "Services", "Hide XXX", "Hide Others", "Show All", "Minimize", "Zoom", >> "Bring All To Front", really everything is grayed out right after my app has >> launched! >> What could be the problem here? How can I find out what's going awry here? > My first guess is that there's an exception occurring during app > startup. Cocoa is catching the exception, so your app isn't > crashing, but the exception is interrupting startup and preventing > various tasks from being performed. > Probably best to try to reproduce the issue when running under > Xcode with a breakpoint for all Objective-C exceptions set. I'm not very familiar with Xcode so let me know if I did anything wrong here. Here's what I did: 1) Product-Scheme-Edit Scheme: Change build configuration to Debug 2) Debug-Breakpoints-Create Exception Breakpoint. I configured the breakpoint like this: Exception: Objective-C Break: On Throw Action: Sound / Blow Unfortunately, the error is still there and no sound was played so I guess it's not an Objective-C exception. (unless I'm doing something wrong here) Any other ideas? -- Best regards, Andreas Falkenhahnmailto:andr...@falkenhahn.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: Sometimes all my menus are disabled
On Feb 12, 2017, at 11:01 AM, Andreas Falkenhahn wrote: > > I'm experiencing a strange issue with my app. Sometimes, maybe in 1 out of 10 > programs starts, all menus of my app are grayed out, including standard menus > like "Services", "Hide XXX", "Hide Others", "Show All", "Minimize", "Zoom", > "Bring All To Front", really everything is grayed out right after my app has > launched! > What could be the problem here? How can I find out what's going awry here? My first guess is that there's an exception occurring during app startup. Cocoa is catching the exception, so your app isn't crashing, but the exception is interrupting startup and preventing various tasks from being performed. Probably best to try to reproduce the issue when running under Xcode with a breakpoint for all Objective-C exceptions set. Regards, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Sometimes all my menus are disabled
I'm experiencing a strange issue with my app. Sometimes, maybe in 1 out of 10 programs starts, all menus of my app are grayed out, including standard menus like "Services", "Hide XXX", "Hide Others", "Show All", "Minimize", "Zoom", "Bring All To Front", really everything is grayed out right after my app has launched! I don't really know what to do about this because I don't have any actual code in my app that relates to menus. The menu is created in Interface Builder and the individual items are connected to "AppDelegate menuClick:" in the "Sent Actions" part of Xcode. That's pretty much all I have. What could be the problem here? How can I find out what's going awry here? As I said, in 9 of 10 attempts everything works fine, but in maybe 1 of 10 attempts all menus are grayed out right after my app has launched, making it impossible to use my app :-( -- Best regards, Andreas Falkenhahn mailto:andr...@falkenhahn.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: Intercept Save when closing NSDocument
___ 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