Re: Sometimes all my menus are disabled

2017-02-15 Thread Gary L. Wade
If I were you, the first thing I’d do is put what you have (your pre-work and 
any backups) in a repository so you can track your history.  Xcode has made 
integration with Git so easy.  There are definitely some shortcomings with more 
esoteric needs, but for the most part, you’d be fine sticking only with Xcode.

After making your local Git repository, you should set up a remote.  For me, I 
use free Bitbucket for my online storage of my private, single-user Git 
repositories, and their app SourceTree is also free and provides solutions for 
those things Xcode doesn’t give you.  There are other solutions and services 
that may be better, but for a single-user team wanting to be budget-conscious 
and keep your code private, that’s what I’d recommend.

Once you have your repository in place, tracking errant changes by Xcode 
migrations is just as easy as looking at a diff.
--
Gary L. Wade
http://www.garywade.com/ 
> On Feb 15, 2017, at 9:10 AM, Andreas Falkenhahn  
> wrote:
> 
> On 14.02.2017 at 23:15 Graham Cox wrote:
> 
>> It’s usually easier to float downstream.
> 
> +1 for nice metaphor.
> 
> On the good news side: I've fixed it now. The trick was to first fix the 
> spurious menu
> trees directly in the XML, then to delete keyedobjects.nib, then to make a 
> dummy change
> directly in Interface Builder to force it to re-compile keyedobjects.nib and 
> then it
> finally worked. That was quite a tough one but I still feel more satisfied 
> now than
> I'd have been if I had re-created the whole shebang from scratch, even though 
> that'd
> probably have been faster.
> 
>> Sure, it could be. Bugs happen. XCode bugs happen a lot.
> 
> That definitely seems so because I definitely didn't mess with the XML but 
> still the
> whole menu tree was listed as a submenu of a separator item and when 
> examining the
> XML generated by my PPC Macintosh version of Xcode the menu tree definition 
> is correct
> in that file. So it must have been introduced during transitioning to the 
> latest Xcode
> (Or I did something really stupid without realizing it but I can't imagine 
> that it's
> even possible in Xcode to duplicate the whole menu tree and insert it as a 
> submenu
> of a separator item. That's just utter non-sense and that's why it didn't 
> appear in
> Xcode either, just in the XML.)
> 
> Anyway, issue fixed. Thanks to all who helped!
> 
> -- 
> 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

2017-02-15 Thread Andreas Falkenhahn
On 14.02.2017 at 23:15 Graham Cox wrote:

> It’s usually easier to float downstream.

+1 for nice metaphor.

On the good news side: I've fixed it now. The trick was to first fix the 
spurious menu
trees directly in the XML, then to delete keyedobjects.nib, then to make a 
dummy change
directly in Interface Builder to force it to re-compile keyedobjects.nib and 
then it
finally worked. That was quite a tough one but I still feel more satisfied now 
than
I'd have been if I had re-created the whole shebang from scratch, even though 
that'd
probably have been faster.

> Sure, it could be. Bugs happen. XCode bugs happen a lot.

That definitely seems so because I definitely didn't mess with the XML but 
still the
whole menu tree was listed as a submenu of a separator item and when examining 
the
XML generated by my PPC Macintosh version of Xcode the menu tree definition is 
correct
in that file. So it must have been introduced during transitioning to the 
latest Xcode
(Or I did something really stupid without realizing it but I can't imagine that 
it's
even possible in Xcode to duplicate the whole menu tree and insert it as a 
submenu
of a separator item. That's just utter non-sense and that's why it didn't 
appear in
Xcode either, just in the XML.)

Anyway, issue fixed. Thanks to all who helped!

-- 
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

2017-02-14 Thread Alastair Houghton
On 14 Feb 2017, at 22:15, Graham Cox  wrote:
> 
>> On 15 Feb 2017, at 12:39 AM, Andreas Falkenhahn  
>> wrote:
>> 
>> I knew how to use IB on the old PowerPC Mac,
>> but that was 10 years ago.
> 
> Well, it hasn’t changed that much in principle. In fact it’s got a lot better 
> in most respects because it stays in sync with your code and is not a 
> separate app. Some things are worse though, like the pick list for UI 
> elements, which makes you do a lot of scrolling to get to the one you want.

Personally I preferred it as a separate app; the “staying in sync with your 
code” part wasn’t such a huge problem in practice and could probably have been 
fixed without integrating it (which, particularly because it went 
single-window, forces people to use Xcode as their editor).  I also liked 
having the separate window for the nib file structure - the side bar can get 
quite cluttered in more complicated nibs.

But I’m not going to turn this into a critique of Xcode design decisions.

> Now I'm trying to compile this old project on a
>> 10.12 system with the latest Xcode but somehow the project was messed up by
>> Xcode when converting it from the old format to the new one and now it 
>> shows weird issues.
> 
> So it messed up. That’s annoying, but should be fixable by spending half an 
> hour in IB to identify and fix the broken connectins (or whatever).

You will also need to check API behaviour.  Cocoa behaves quite differently in 
some places depending on the system version and Xcode version used to build 
code; I’m not sure if there’s a list of all of these places anywhere - it’d be 
quite useful for this kind of situation.  (Formatters in particular have rather 
different behaviour.)

When I first saw Apple doing this, I thought it was a good idea.  I now think 
otherwise.  It should have based behaviour changes on a separate API level 
setting, which would have meant Xcode could issue warnings when an API level 
stopped being supported so that you’d know what to focus on.  I know we’ve 
managed to ship bugs on a couple of occasions because of API behaviour changes 
that we didn’t appreciate or spot; thankfully these have tended to be cosmetic 
(e.g. percentages were being formatted incorrectly), but it’s still worth 
checking *everything*.

> Of course, I could just dump the old project and start a new one with the
>> latest Xcode, re-creating everything from scratch. But do you really think
>> that is a satisfactory solution?
> 
> It isn’t the ideal solution, but sometimes you are faced with hard choices.
> 
> One problem sounds like you’ve put a lot of interfaces into one nib file, so 
> that’s going to make life harder than necessary,

That isn’t a big problem in practice.  iDefrag and iPartition have quite a few 
things in a single main nib file that would probably be split out into multiple 
nibs in a more modern code base; I’ve had no reason to change that (they don’t 
use window controllers or view controllers, so it just isn’t a problem).

> and another is that you’ve gone against the usual conventions with menu 
> actions and targets, so that’s going to make life harder than necessary.

[snip]

> The obvious thing to me was to get into IB and start figuring out the 
> problem. Instead you ranted about how much of a time sink it was being 
> because IB was different and you’d forgotten how to use it. Not only that but 
> the way your project is organised is unconventional, to say the least. If you 
> prefer to swim upstream, you only have yourself to blame.

To be fair to Andreas, the stream has changed direction somewhat over the 
years, and I’d be lying if I said I’d never found updating projects to be 
compatible with the new version of Xcode I was forced to use because of OS 
compatibility issues was not an annoyance.

(Indeed, the last round of Xcode’s automatic project upgrades caused yet 
another problem, this time with code signing.)

Kind regards,

Alastair.

--
http://alastairs-place.net


___

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

2017-02-14 Thread Graham Cox

> On 15 Feb 2017, at 12:39 AM, Andreas Falkenhahn  
> wrote:
> 
> I knew how to use IB on the old PowerPC Mac,
> but that was 10 years ago.

Well, it hasn’t changed that much in principle. In fact it’s got a lot better 
in most respects because it stays in sync with your code and is not a separate 
app. Some things are worse though, like the pick list for UI elements, which 
makes you do a lot of scrolling to get to the one you want.


> Now I'm trying to compile this old project on a
> 10.12 system with the latest Xcode but somehow the project was messed up by
> Xcode when converting it from the old format to the new one and now it 
> shows weird issues.

So it messed up. That’s annoying, but should be fixable by spending half an 
hour in IB to identify and fix the broken connectins (or whatever).

> Of course, I could just dump the old project and start a new one with the
> latest Xcode, re-creating everything from scratch. But do you really think
> that is a satisfactory solution?

It isn’t the ideal solution, but sometimes you are faced with hard choices.

One problem sounds like you’ve put a lot of interfaces into one nib file, so 
that’s going to make life harder than necessary, and another is that you’ve 
gone against the usual conventions with menu actions and targets, so that’s 
going to make life harder than necessary.

It’s usually easier to float downstream.

> ...several more experienced people have had a look at the project and although
> it is really minimal, nobody (!) has been able to solve the issue.

That doesn’t seem to be the case, judging by ’s answer...

> Instead,
> it was suggested that this might even be a bug in Xcode or Mac OS. So it's not
> a matter of not knowing how to use Xcode but rather a matter of something
> being buggy.

Sure, it could be. Bugs happen. XCode bugs happen a lot.


> 
> Thanks for your effort but before jumping to quick conclusions next time
> you should probably just read all mails on the matter first, no offense! :-)


I did read all the mails.

The obvious thing to me was to get into IB and start figuring out the problem. 
Instead you ranted about how much of a time sink it was being because IB was 
different and you’d forgotten how to use it. Not only that but the way your 
project is organised is unconventional, to say the least. If you prefer to swim 
upstream, you only have yourself to blame.

No offence (and none taken). Good luck!

—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: Sometimes all my menus are disabled

2017-02-14 Thread Andreas Falkenhahn
On 14.02.2017 at 15:02 じょいすじょん wrote:

>> On Feb 14, 2017, at 1:58, Andreas Falkenhahn  wrote:

>> On 13.02.2017 at 17:33 じょいすじょん wrote:

>>> Yeah, my first suggestion didn't work, but points out the problem overall 
>>> in you nib.
>>> Looks like somebody did try to edit the xml before and munged it.

>> I certainly did not mess with the XML! Xcode must have messed this up when 
>> converting
>> the nib file from the old Xcode PowerPC project format to the new one. 

>>> You also have nested menu duplicates inside your menus in the nib file 
>>> itself!

>>> MainMenu
>>>Hollywood
>>>Menu
>>>About Hollywood
>>>Separator
>>>MainMenu (duplicated here as sub menu...)
>>>Preferences
>>>... (and on)


>>> Delete that other MainMenu inside and it seems to work thus far.

>> I've removed the complete duplicate MainMenu tree (the one after the 
>> separator
>> item, see above) from designable.nib using a text editor. However, it still
>> doesn't work. Same behaviour as before. 
> Strange, because after the changes I've suggested I am no longer able to get 
> any issues.

Hmm, interesting. Can you upload your project so that I can give it a try?

-- 
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

2017-02-14 Thread じょいすじょん

> On Feb 14, 2017, at 1:58, Andreas Falkenhahn  wrote:
> 
> On 13.02.2017 at 17:33 じょいすじょん wrote:
> 
>> Yeah, my first suggestion didn't work, but points out the problem overall in 
>> you nib.
>> Looks like somebody did try to edit the xml before and munged it.
> 
> I certainly did not mess with the XML! Xcode must have messed this up when 
> converting
> the nib file from the old Xcode PowerPC project format to the new one. 
> 
>> You also have nested menu duplicates inside your menus in the nib file 
>> itself!
> 
>> MainMenu
>>Hollywood
>>Menu
>>About Hollywood
>>Separator
>>MainMenu (duplicated here as sub menu...)
>>Preferences
>>... (and on)
> 
> 
>> Delete that other MainMenu inside and it seems to work thus far.
> 
> I've removed the complete duplicate MainMenu tree (the one after the separator
> item, see above) from designable.nib using a text editor. However, it still
> doesn't work. Same behaviour as before. 
Strange, because after the changes I've suggested I am no longer able to get 
any issues.
You really do just need to fix your nib. It's not that hard. If you're having 
trouble with modern Xcode, well, you have to pick it up.
IB has been pretty self similar for many years now.
Just spend the time doing fixing it.
It's not unreasonable to expect some project gets a little borked transitioning 
it from a 10 year old version of Xcode to a modern one. A LOT has changed since 
then.
 

> 
> 
> 
> This annoying issue is just another reason why I prefer doing things in code.
> This has already cost me hours over hours and it's still not solved. Even
> worse, there's a profound feeling of helplessness in the air. And re-creating
> everything from scratch is not an option! I certainly did not mess with the
> XML. Xcode must have messed this up when converting the project from the
> old format to the new one. All such things wouldn't be possible with code.
> Code could be cleanly adapted to new designs while nobody can tell what black
> magic is going on inside those arcane nib files. It's quite depressing. $0.02
> 
> 
> 
> -- 
> 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

2017-02-14 Thread Andreas Falkenhahn
On 13.02.2017 at 23:13 Graham Cox wrote:

> The problem here is that you seem unwilling to take a little time
> to learn the basics of Interface Builder. 

No, that's not the problem here. I knew how to use IB on the old PowerPC Mac,
but that was 10 years ago. Now I'm trying to compile this old project on a
10.12 system with the latest Xcode but somehow the project was messed up by
Xcode when converting it from the old format to the new one and now it 
shows weird issues.

Of course, I could just dump the old project and start a new one with the
latest Xcode, re-creating everything from scratch. But do you really think
that is a satisfactory solution? To me, this is a defeat because I'd have
to acknowledge that it's impossible to transition a project from an old
PowerPC Mac to the latest Xcode and I just refuse to believe that this
should be impossible. So the real problem here is to find out what's wrong
with this particular project which is not a matter of being "unwilling to
take a little time to learn the basics of Interface Builder" because...

> Don’t you think that would
> be time better spent than beating for hours on a problem that would
> take a developer experienced with IB a few minutes?

...several more experienced people have had a look at the project and although
it is really minimal, nobody (!) has been able to solve the issue. Instead,
it was suggested that this might even be a bug in Xcode or Mac OS. So it's not
a matter of not knowing how to use Xcode but rather a matter of something
being buggy.

> Someone has to point out the elephant in this particular room.

Thanks for your effort but before jumping to quick conclusions next time
you should probably just read all mails on the matter first, no offense! :-)

-- 
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

2017-02-13 Thread Graham Cox

> On 14 Feb 2017, at 3:58 AM, Andreas Falkenhahn  wrote:
> 
> This annoying issue is just another reason why I prefer doing things in code.
> This has already cost me hours over hours and it's still not solved.

> True, I can see that. But how do I rewire my nib? I don't remember anything
> about Interface Builder. 


The problem here is that you seem unwilling to take a little time to learn the 
basics of Interface Builder. Don’t you think that would be time better spent 
than beating for hours on a problem that would take a developer experienced 
with IB a few minutes?

You cannot program effectively using Cocoa without knowing how to use IB. The 
POINT of IB is to save you having to spend hours coding to set up simple 
interfaces.

Someone has to point out the elephant in this particular room.

—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: Sometimes all my menus are disabled

2017-02-13 Thread Gary L. Wade
Well, you may have a valid bug to report to Apple.  You probably would want to 
use a tech support incident, which will get feedback faster, and in the past, 
when the issue turned out to be Apple’s bug, they’ve credited it back to me.  
Otherwise, definitely mark this as a serious bug.
--
Gary L. Wade
http://www.garywade.com/ 
> On Feb 13, 2017, at 12:54 PM, Andreas Falkenhahn  
> wrote:
> 
> On 13.02.2017 at 19:49 Gary L. Wade wrote:
> 
>> Your assignments for the File’s Owner and Application objects are
>> messed up.  First, clear the custom class values for these two
>> objects.  After that, connect the delegate outlet in the Application
>> object to your embedded AppDelegate object.
> 
> Thanks, but unfortunately, this doesn't help either (or I did it wrong).
> 
> Here's what I did:
> 
> 1) Select File's Owner, go to Custom Class section in the Identity
> inspector, delete what was inside the "Class" text field; the
> "Class" text field is now empty but Xcode shows "NSObject" in
> gray (indicating that this is probably the default)
> 
> 2) Select Application, and repeat the steps from above; the "Class"
> text field for Application is now empty as well and Xcode shows
> "NSApplication" in gray 
> 
> 3) Then I changed to the Connections inspector for Application,
> held down CMD and dragged the "delegate" item in the "Outlets"
> section to my AppDelegate object; thus, it now shows
> "delegate: AppDelegate" in the Connections inspector
> 
> However, as I said, the menus are still disabled in every 3rd
> attempt or so :( It's really a frustrating experience. Such a
> simple project, so much pain!
> 
> 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

2017-02-13 Thread Andreas Falkenhahn
On 13.02.2017 at 19:49 Gary L. Wade wrote:

> Your assignments for the File’s Owner and Application objects are
> messed up.  First, clear the custom class values for these two
> objects.  After that, connect the delegate outlet in the Application
> object to your embedded AppDelegate object.

Thanks, but unfortunately, this doesn't help either (or I did it wrong).

Here's what I did:

1) Select File's Owner, go to Custom Class section in the Identity
inspector, delete what was inside the "Class" text field; the
"Class" text field is now empty but Xcode shows "NSObject" in
gray (indicating that this is probably the default)

2) Select Application, and repeat the steps from above; the "Class"
text field for Application is now empty as well and Xcode shows
"NSApplication" in gray 

3) Then I changed to the Connections inspector for Application,
held down CMD and dragged the "delegate" item in the "Outlets"
section to my AppDelegate object; thus, it now shows
"delegate: AppDelegate" in the Connections inspector

However, as I said, the menus are still disabled in every 3rd
attempt or so :( It's really a frustrating experience. Such a
simple project, so much pain!

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

2017-02-13 Thread Gary L. Wade
Your assignments for the File’s Owner and Application objects are messed up.  
First, clear the custom class values for these two objects.  After that, 
connect the delegate outlet in the Application object to your embedded 
AppDelegate object.
--
Gary L. Wade
http://www.garywade.com/ 
> On Feb 13, 2017, at 9:41 AM, Andreas Falkenhahn  
> wrote:
> 
> On 13.02.2017 at 18:16 Gary L. Wade wrote:
> 
>> I haven't looked at your NIB, but I've seen something of what's
>> described with errant choices of diff tools and source code merging,
> 
> That certainly can't be the case since I'm not using any diff or
> merging tools. It's also just a single developer project, i.e.
> I'm the only one working on it. 
> 
>> usually when a user just accepts a merge without eyeballing it. If
>> you've got a history of your revisions, you should find where things
>> changed badly. Also, if you've got a built app that works, I
>> remember being able to add some extra things on older NIBs to make
>> them openable in Interface Builder, but that was a really long time ago.
> 
> Unfortunately, I don't have a history of revisions. All I can say is
> that the error doesn't occur with the old Xcode on the PowerPC Mac
> running 10.5 and also it doesn't occur with Xcode 3.2 on my x86 Mac
> running 10.6. It does, however, occur in 10.12 using the latest Xcode.
> 
> But, the project that I've uploaded to 
> http://www.falkenhahn.com/tmp/guitest.tar.gz 
> is really ridiculously simple. It's just a window, a button, and a
> menu bar. That's all. Is really nobody here able to fix this project
> *without* re-creating it from scratch? It's just a few kilobytes of
> XML after all... 
> 
> -- 
> 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

2017-02-13 Thread Andreas Falkenhahn
On 13.02.2017 at 18:16 Gary L. Wade wrote:

> I haven't looked at your NIB, but I've seen something of what's
> described with errant choices of diff tools and source code merging,

That certainly can't be the case since I'm not using any diff or
merging tools. It's also just a single developer project, i.e.
I'm the only one working on it. 

> usually when a user just accepts a merge without eyeballing it. If
> you've got a history of your revisions, you should find where things
> changed badly. Also, if you've got a built app that works, I
> remember being able to add some extra things on older NIBs to make
> them openable in Interface Builder, but that was a really long time ago.

Unfortunately, I don't have a history of revisions. All I can say is
that the error doesn't occur with the old Xcode on the PowerPC Mac
running 10.5 and also it doesn't occur with Xcode 3.2 on my x86 Mac
running 10.6. It does, however, occur in 10.12 using the latest Xcode.

But, the project that I've uploaded to 
http://www.falkenhahn.com/tmp/guitest.tar.gz 
is really ridiculously simple. It's just a window, a button, and a
menu bar. That's all. Is really nobody here able to fix this project
*without* re-creating it from scratch? It's just a few kilobytes of
XML after all... 

-- 
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

2017-02-13 Thread Gary L. Wade
I haven't looked at your NIB, but I've seen something of what's described with 
errant choices of diff tools and source code merging, usually when a user just 
accepts a merge without eyeballing it. If you've got a history of your 
revisions, you should find where things changed badly. Also, if you've got a 
built app that works, I remember being able to add some extra things on older 
NIBs to make them openable in Interface Builder, but that was a really long 
time ago.

When editing the text of a NIB, you have to be really careful with internal 
identifiers, which are essentially freeze-dried pointers within the NIB, and 
this may be why your forensic work is failing. When I've had to resort to this 
(nowadays in cases of auto layout mainly) I let Apple know that this is the 
only way I could do this or that.

Basically, try to find your oldest working version and go forward with that. If 
you can compare a working vs immediately non-working, that's even better.
--
Gary L. Wade (Sent from my iPhone)
http://www.garywade.com/

> On Feb 13, 2017, at 8:58 AM, Andreas Falkenhahn  
> wrote:
> 
>> On 13.02.2017 at 17:33 じょいすじょん wrote:
>> 
>> Yeah, my first suggestion didn't work, but points out the problem overall in 
>> you nib.
>> Looks like somebody did try to edit the xml before and munged it.
> 
> I certainly did not mess with the XML! Xcode must have messed this up when 
> converting
> the nib file from the old Xcode PowerPC project format to the new one. 
> 
>> You also have nested menu duplicates inside your menus in the nib file 
>> itself!
> 
>> MainMenu
>>Hollywood
>>Menu
>>About Hollywood
>>Separator
>>MainMenu (duplicated here as sub menu...)
>>Preferences
>>... (and on)
> 
> 
>> Delete that other MainMenu inside and it seems to work thus far.
> 
> I've removed the complete duplicate MainMenu tree (the one after the separator
> item, see above) from designable.nib using a text editor. However, it still
> doesn't work. Same behaviour as before. 
> 
> 
> 
> This annoying issue is just another reason why I prefer doing things in code.
> This has already cost me hours over hours and it's still not solved. Even
> worse, there's a profound feeling of helplessness in the air. And re-creating
> everything from scratch is not an option! I certainly did not mess with the
> XML. Xcode must have messed this up when converting the project from the
> old format to the new one. All such things wouldn't be possible with code.
> Code could be cleanly adapted to new designs while nobody can tell what black
> magic is going on inside those arcane nib files. It's quite depressing. $0.02
> 
> 
> 
> -- 
> 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

2017-02-13 Thread Andreas Falkenhahn
On 13.02.2017 at 17:33 じょいすじょん wrote:

> Yeah, my first suggestion didn't work, but points out the problem overall in 
> you nib.
> Looks like somebody did try to edit the xml before and munged it.

I certainly did not mess with the XML! Xcode must have messed this up when 
converting
the nib file from the old Xcode PowerPC project format to the new one. 

> You also have nested menu duplicates inside your menus in the nib file itself!

> MainMenu
> Hollywood
> Menu
> About Hollywood
> Separator
> MainMenu (duplicated here as sub menu...)
> Preferences
> ... (and on)


> Delete that other MainMenu inside and it seems to work thus far.

I've removed the complete duplicate MainMenu tree (the one after the separator
item, see above) from designable.nib using a text editor. However, it still
doesn't work. Same behaviour as before. 



This annoying issue is just another reason why I prefer doing things in code.
This has already cost me hours over hours and it's still not solved. Even
worse, there's a profound feeling of helplessness in the air. And re-creating
everything from scratch is not an option! I certainly did not mess with the
XML. Xcode must have messed this up when converting the project from the
old format to the new one. All such things wouldn't be possible with code.
Code could be cleanly adapted to new designs while nobody can tell what black
magic is going on inside those arcane nib files. It's quite depressing. $0.02



-- 
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

2017-02-13 Thread M Pulis
Consider getting an old PowerPC Mac, run your app as a blueprint and  
rebuild a new interface in the current Xcode. That will likely be  
faster than hacking away at your current nib, and a bit of fun as  
well. Take it one window at a time so you understand what is happening.


That is how we brought our 1983 to 1995 Lisa -> MPW -> CodeWarrior  
Pascal app into the current century and ended up with a nice clean UI  
and Objective C.


Good Luck!

Gary


On Feb 13, 2017, at 8:56 AM, Andreas Falkenhahn wrote:


On 13.02.2017 at 16:40 じょいすじょん wrote:


You have a lot of dupes in your nib file connections.


For example, select the AppDelegate in the nib in IB, and look at  
the Connections Inspector.

You'll see it has 2 Main Menu referencing outlets.
So it's hitting a random one of the two.
You have this kind of duplication in lots of places in your nib.
Rewire your nib.


True, I can see that. But how do I rewire my nib? I don't remember  
anything
about Interface Builder. As I said, I last worked on this project  
about 10

years ago on a PowerPC Mac.

So what exactly do I have to do? I've tried deleting the duplicate  
"mainMenu"

entry in "Referencing Outlets" but this didn't change anything...

--
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/toothpic%40fastq.com

This email sent to tooth...@fastq.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

2017-02-13 Thread じょいすじょん
Yeah, my first suggestion didn't work, but points out the problem overall in 
you nib.
Looks like somebody did try to edit the xml before and munged it.

You also have nested menu duplicates inside your menus in the nib file itself!

MainMenu
Hollywood
Menu
About Hollywood
Separator
MainMenu (duplicated here as sub menu...)
Preferences
... (and on)


Delete that other MainMenu inside and it seems to work thus far.


> On Feb 14, 2017, at 0:56, Andreas Falkenhahn  wrote:
> 
> On 13.02.2017 at 16:40 じょいすじょん wrote:
> 
>> You have a lot of dupes in your nib file connections.
> 
>> For example, select the AppDelegate in the nib in IB, and look at the 
>> Connections Inspector.
>> You'll see it has 2 Main Menu referencing outlets.
>> So it's hitting a random one of the two.
>> You have this kind of duplication in lots of places in your nib.
>> Rewire your nib.
> 
> True, I can see that. But how do I rewire my nib? I don't remember anything
> about Interface Builder. As I said, I last worked on this project about 10
> years ago on a PowerPC Mac.
> 
> So what exactly do I have to do? I've tried deleting the duplicate "mainMenu"
> entry in "Referencing Outlets" but this didn't change anything...
> 
> -- 
> 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

2017-02-13 Thread Andreas Falkenhahn
On 13.02.2017 at 16:40 じょいすじょん wrote:

> You have a lot of dupes in your nib file connections.

> For example, select the AppDelegate in the nib in IB, and look at the 
> Connections Inspector.
> You'll see it has 2 Main Menu referencing outlets.
> So it's hitting a random one of the two.
> You have this kind of duplication in lots of places in your nib.
> Rewire your nib.

True, I can see that. But how do I rewire my nib? I don't remember anything
about Interface Builder. As I said, I last worked on this project about 10
years ago on a PowerPC Mac.

So what exactly do I have to do? I've tried deleting the duplicate "mainMenu"
entry in "Referencing Outlets" but this didn't change anything...

-- 
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

2017-02-13 Thread Andreas Falkenhahn
On 13.02.2017 at 16:34 Steve Mills wrote:

> I've dinked around with it a bit more and ended up replacing
> MainMenu.nib with a new MainMenu.xib. That fixes it. I'm on an older
> Xcode now, so I can't open your MainMenu.nib, so I opened its
> designable.nib with a text editor to see if there's anything
> obvious. One thing that's really weird is that all the menus for the
> menubar are also duplicated as submenu items of the first separator
> after the About item. Although it's not an exact copy, since Plugins
> doesn't appear in that version of the app menu.

> So yeah, make a new xib and throw the old one out.

Oh, but that's a lot of work. My original MainMenu.nib contains lots
of windows. Recreating all of them is quite a major effort. Can't this
be fixed with a text editor somehow? :-)

-- 
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

2017-02-13 Thread じょいすじょん
You have a lot of dupes in your nib file connections.

For example, select the AppDelegate in the nib in IB, and look at the 
Connections Inspector.
You'll see it has 2 Main Menu referencing outlets.
So it's hitting a random one of the two.
You have this kind of duplication in lots of places in your nib.
Rewire your nib.

> On Feb 13, 2017, at 23:12, Andreas Falkenhahn  wrote:
> 
> On 12.02.2017 at 21:49 Kyle Sluder wrote:
> 
>> 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.
> 
> Thanks for the feedback. Unfortunately, I'm pretty much out of ideas now.
> 
> I started cutting down my program to the absolute minimum to see if the
> error would go away. Well, it didn't. This is the code that's left of my
> program now:
> 
>   #import "AppDelegate.h"
> 
>   @implementation AppDelegate
>   - (void) clickButton:(id)sender {}
>   - (void) menuClick:(id)sender {}
>   - (void) applicationDidFinishLaunching:(NSNotification *) aNotification
>   {
>   [mainWindow makeKeyAndOrderFront:nil];
>   }
>   @end 
> 
>   
> 
>   #import 
> 
>   int main(int argc, char *argv[])
>   {
>   return NSApplicationMain(argc, argv);
>   }
> 
> And the error is still there. Bottom line: The error must be in the
> MainMenu.nib or in the Xcode project. Maybe Xcode has messed up one of
> the files when migrating it from the old Xcode on PowerPC to Xcode 8.
> 
> Unfortunately, I don't know where to look because I remember nothing about
> Interface Builder. That's why I have uploaded a VERY SMALL test project
> here: http://www.falkenhahn.com/tmp/guitest.tar.gz
> 
> It really only contains the code quoted above, a single window with a
> single button and the original menu bar that is behaving erratically. 
> 
> As I said in my first mail, the really confusing fact is that it usually
> works just fine. But in every 3rd attempt or so suddenly all menus are
> disabled and I have no idea what's going on! It is really weird but it
> is clearly reproducible. I know I said before that it fails in 1 out of 10
> attempts but it's more like 1 in 3 attempts. It's really clearly reproducible.
> It happens all the time though not always.
> 
> As I'm really out of ideas now I'd be extremely glad if somebody with
> IB experience could just take a quick look at this project and maybe come up
> with an explanation. As I said, it's an absolutely minimal project.
> It should be really straightforward to analyze for people who are experienced
> with IB.
> 
> Thanks a lot for any help!
> 
> -- 
> 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/dangerwillrobinsondanger%40gmail.com
> 
> This email sent to dangerwillrobinsondan...@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: Sometimes all my menus are disabled

2017-02-13 Thread Steve Mills

On Feb 13, 2017, at 08:50 AM, Steve Mills  wrote:

On Feb 13, 2017, at 08:12:59, Andreas Falkenhahn  wrote:

Unfortunately, I don't know where to look because I remember nothing about
Interface Builder. That's why I have uploaded a VERY SMALL test project
here: http://www.falkenhahn.com/tmp/guitest.tar.gz

Same problem here. I added this:

-(BOOL)validateMenuItem:(NSMenuItem *)menuItem
{
       NSLog(@"%@", menuItem.title);
     return YES;
}

to help see what's going on. When it works, it logs About, Prefs, and Plugins. 
When it fails, it only logs About and Prefs. Gotta get to the office now, or 
I'd investigate further.

I've dinked around with it a bit more and ended up replacing MainMenu.nib with 
a new MainMenu.xib. That fixes it. I'm on an older Xcode now, so I can't open 
your MainMenu.nib, so I opened its designable.nib with a text editor to see if 
there's anything obvious. One thing that's really weird is that all the menus 
for the menubar are also duplicated as submenu items of the first separator 
after the About item. Although it's not an exact copy, since Plugins doesn't 
appear in that version of the app menu.

So yeah, make a new xib and throw the old one out.

Sent from iCloud's ridiculous UI, so, sorry about the formatting

 
 
___

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

2017-02-13 Thread Steve Mills
On Feb 13, 2017, at 08:12:59, Andreas Falkenhahn  wrote:
> 
> Unfortunately, I don't know where to look because I remember nothing about
> Interface Builder. That's why I have uploaded a VERY SMALL test project
> here: http://www.falkenhahn.com/tmp/guitest.tar.gz

Same problem here. I added this:

-(BOOL)validateMenuItem:(NSMenuItem *)menuItem
{
NSLog(@"%@", menuItem.title);
return YES;
}

to help see what's going on. When it works, it logs About, Prefs, and Plugins. 
When it fails, it only logs About and Prefs. Gotta get to the office now, or 
I'd investigate further.

BTW, when you use ellipses in menu item titles, use the real ellipses 
character, option-semicolon.

--
Steve Mills
Drummer, Mac geek


___

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

2017-02-13 Thread Andreas Falkenhahn
On 12.02.2017 at 21:49 Kyle Sluder wrote:

> 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.

Thanks for the feedback. Unfortunately, I'm pretty much out of ideas now.

I started cutting down my program to the absolute minimum to see if the
error would go away. Well, it didn't. This is the code that's left of my
program now:

#import "AppDelegate.h"

@implementation AppDelegate
- (void) clickButton:(id)sender {}
- (void) menuClick:(id)sender {}
- (void) applicationDidFinishLaunching:(NSNotification *) aNotification
{
[mainWindow makeKeyAndOrderFront:nil];
}
@end 

   

#import 

int main(int argc, char *argv[])
{
return NSApplicationMain(argc, argv);
}

And the error is still there. Bottom line: The error must be in the
MainMenu.nib or in the Xcode project. Maybe Xcode has messed up one of
the files when migrating it from the old Xcode on PowerPC to Xcode 8.

Unfortunately, I don't know where to look because I remember nothing about
Interface Builder. That's why I have uploaded a VERY SMALL test project
here: http://www.falkenhahn.com/tmp/guitest.tar.gz

It really only contains the code quoted above, a single window with a
single button and the original menu bar that is behaving erratically. 

As I said in my first mail, the really confusing fact is that it usually
works just fine. But in every 3rd attempt or so suddenly all menus are
disabled and I have no idea what's going on! It is really weird but it
is clearly reproducible. I know I said before that it fails in 1 out of 10
attempts but it's more like 1 in 3 attempts. It's really clearly reproducible.
It happens all the time though not always.

As I'm really out of ideas now I'd be extremely glad if somebody with
IB experience could just take a quick look at this project and maybe come up
with an explanation. As I said, it's an absolutely minimal project.
It should be really straightforward to analyze for people who are experienced
with IB.

Thanks a lot for any help!

-- 
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

2017-02-12 Thread Uli Kusterer
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


Re: Sometimes all my menus are disabled

2017-02-12 Thread Graham Cox
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

2017-02-12 Thread Kyle Sluder

>> 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

2017-02-12 Thread Andreas Falkenhahn
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

2017-02-12 Thread Andreas Falkenhahn
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

2017-02-12 Thread Kyle Sluder


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

2017-02-12 Thread Andreas Falkenhahn
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

2017-02-12 Thread Ken Thomases
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

2017-02-12 Thread Andreas Falkenhahn
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