Sunday, December 17, 2017

#1 2009-09-18 10:19:28 pm

HippoMan
Member
Registered: 2008-09-18
Posts: 114

Outlets not recognized.

To the best of my understanding, I'm following the instructions in the tutorials. However, I'm not able to get the Interface Builder to recognize any of my outlets in my ASOC app. I'm sure I'm missing a step, but I can't figure out what it would be.

First of all, I created a new Cocoa-Applescript Application called TestProject. In this project, I started out with a standard app delegate called TestProjectAppDelegate.applescript. I added a reference to an outlet called aOutlet, and this is what I have so far:

Applescript:

--
-- TestProjectAppDelegate.applescript
-- TestProject
--
-- Created by Hippo Man on 9/18/09.
-- Copyright 2009 __MyCompanyName__. All rights reserved.
--

script TestProjectAppDelegate
   
   property parent : class "NSObject"

   property aOutlet : missing value
   
   end applicationWillFinishLaunching_
   
   on applicationShouldTerminate_(sender)
       return my NSTerminateNow
   end applicationShouldTerminate_
   
end script

I then opened up MainMenu.xib, and I control-clicked on the blue cube for Test Project App Delegate. All I see is the following

Outlets
window                    ( )
Received Actions
saveAction:                ( )
Referencing Outlets:
delegate        File's Owner    (*)
New Referencing Outlet            ( )


How come I don't see my aOutlet item?

Thanks in advance for any help you can offer.

Last edited by HippoMan (2009-09-18 10:19:54 pm)


Filed under: outlet, not-appearing

Offline

 

#2 2009-09-18 10:24:37 pm

Craig Williams
Administrator
From:: Ft. Smith, AR
Registered: 2006-12-07
Posts: 888

Re: Outlets not recognized.

Did you save the "TestProjectAppDelegate.applescript" file?

Any outlets you add will not show up in IB until the file is saved.
This is the first thing I do when I don't see outlets I have set up.

Also, you are missing the opening to.

Applescript:

end applicationWillFinishLaunching_

and change this

Applescript:

return my NSTerminateNow

to

Applescript:

return true

my NSTerminateNow is not working properly. Each time you quit your
app it will log an error to the console and/or not close the app.

Offline

 

#3 2009-09-18 10:30:02 pm

HippoMan
Member
Registered: 2008-09-18
Posts: 114

Re: Outlets not recognized.

I saw Read Class Files on the Interface Builder's File menu, and so I selected it. It gave me a file chooser dialog, and then I navigated to my TestProjectAppDelegate.applescript file. I selected that file and clicked on Open.

Now, when I control-click on Test Project App Delegate, I have the following:

Received Actions
applicationShouldTerminate:        ( )
applicationWillFinishLaunching:        ( )
ReferencingOutlets
delegate    File's Owner        (*)
New Referencing Outlet            ( )


However, I still don't see any reference to my aOutlet.

I then tried selecting Reload All Class Files in the Interface Builder's File menu, but nothing changed.

There must be another step I'm missing ... ???

Last edited by HippoMan (2009-09-18 10:30:53 pm)

Offline

 

#4 2009-09-18 10:32:03 pm

Craig Williams
Administrator
From:: Ft. Smith, AR
Registered: 2006-12-07
Posts: 888

Re: Outlets not recognized.

zip it up and email it to craigw@macscripter.net.

Offline

 

#5 2009-09-18 10:41:31 pm

HippoMan
Member
Registered: 2008-09-18
Posts: 114

Re: Outlets not recognized.

Craig Williams wrote:

Did you save the "TestProjectAppDelegate.applescript" file?

Any outlets you add will not show up in IB until the file is saved.
This is the first thing I do when I don't see outlets I have set up.


Yes. I saved it, but the outlet still doesn't show up.

Craig Williams wrote:

Also, you are missing the opening to.

Applescript:

end applicationWillFinishLaunching_


That was a slip of the hand when editing my message. The opening "to" is indeed there in my TestProjectAppDelegate file. Here's the correct code:

Applescript:

--
-- TestProjectAppDelegate.applescript
-- TestProject
--
-- Created by Hippo Man on 9/18/09.
-- Copyright 2009 __MyCompanyName__. All rights reserved.
--

script TestProjectAppDelegate
   
   property parent : class "NSObject"
   
   property aOutlet : missing value
   
   on applicationWillFinishLaunching_(aNotification)
   end applicationWillFinishLaunching_
   
   on applicationShouldTerminate_(sender)
       return my NSTerminateNow
   end applicationShouldTerminate_

end script

Craig Williams wrote:

and change this

Applescript:

return my NSTerminateNow

to

Applescript:

return true

my NSTerminateNow is not working properly. Each time you quit your
app it will log an error to then console and/or not close the app.


I made this change, but I still have the same problem. There is no reference to my aOutlet in the MainMenu.xib file.

Offline

 

#6 2009-09-18 10:54:52 pm

HippoMan
Member
Registered: 2008-09-18
Posts: 114

Re: Outlets not recognized.

Craig Williams wrote:

zip it up and email it to craigw@macscripter.net.


I just sent it. Thank you!

By the way, your SMTP server seems to be doing greylisting, so it might take some time before my message arrives:

2009.09.18-23:49:25 hippo postfix/smtp[17874]: 289F7343001A: to=<craigw@macscripter.net>, relay=xxxx.xxxxxxx.net[xxx.xxx.xxx.xxx]:25, delay=4.1, delays=0.35/0.01/3.6/0.12, dsn=4.0.0, status=deferred (host xxxx.xxxxxxx.net[xxx.xxx.xxx.xxx] said: 451-yyy.yyy.yyy.yyy is not yet authorized to deliver mail from 451 <xxxxxxx@xxxxxxxx.net> to <craigw@macscripter.net>. Please try later. (in reply to RCPT TO command))

Offline

 

#7 2009-09-18 11:43:14 pm

Craig Williams
Administrator
From:: Ft. Smith, AR
Registered: 2006-12-07
Posts: 888

Re: Outlets not recognized.

When I open the project in IB, right click on the instance of "TestProjectAppDelegate" (blue cube)
this is what I see. Are you not seeing the same thing?

outlet.png

Offline

 

#8 2009-09-18 11:56:23 pm

HippoMan
Member
Registered: 2008-09-18
Posts: 114

Re: Outlets not recognized.

No. I'm not seeing that. There is nothing in the "Outlets" section.

Offline

 

#9 2009-09-19 12:15:33 am

HippoMan
Member
Registered: 2008-09-18
Posts: 114

Re: Outlets not recognized.

... but I then did another "Reload All Class Files" in IB, followed by "Read Class Files...".  I navigated to TestProjectAppDelegate.applescript and clicked on "Open". Now, I do see "aOutlet" under the "Outlets" section.

But I did this earlier, and I didn't see that outlet. Weird.

So now, I created yet another new project called NewTestProject. The AppleScript looks like this, and I definitely, positively did a Save:

Applescript:

--
-- NewTestProjectAppDelegate.applescript
-- NewTestProject
--
-- Created by Hippo Man on 9/19/09.
-- Copyright 2009 __MyCompanyName__. All rights reserved.
--

script NewTestProjectAppDelegate
   
   property parent : class "NSObject"
   
   property aOutlet : missing value
   
   on applicationWillFinishLaunching_(aNotification)
   end applicationWillFinishLaunching_
   
   on applicationShouldTerminate_(sender)
       return true
   end applicationShouldTerminate_
   
end script

So then I opened MainMenu.xib and control-clicked on the New Test Project App Delegate blue cube, and it looks like this:

MainMenu.xib.png


And now, I keep trying "Reload All Class Files" and "Read Class Files..." as above, but it isn't changing.

Even more weird.

Last edited by HippoMan (2009-09-19 12:22:08 am)

Offline

 

#10 2009-09-19 12:27:13 am

HippoMan
Member
Registered: 2008-09-18
Posts: 114

Re: Outlets not recognized.

PS: It says at the bottom of my posting window that the '[ img ]' tag is "off", and so I can't post a nice image like you did. How do I get that tag to be turned on?

Offline

 

#11 2009-09-19 12:40:50 am

HippoMan
Member
Registered: 2008-09-18
Posts: 114

Re: Outlets not recognized.

OK. I figured it out. When I was doing "Read Class Files..." during my earlier tests, I was accidentally selecting the wrong file to read. I have so many test projects, I confused myself.

But it looks like "Read Class Files..." of the _correct_ file is indeed needed after a Save is done of the App Delegate.

Here are the steps that I have to take:

1. Create a new Cocoa-AppleScript Application project.

2. Make sure the App Delegate has the following two lines right before the "on applicationWillFinishLaunching_(aNotification)" line:

Applescript:

property parent : class "NSObject"
property aOutlet : missing value

3. Do a Save.

4. Open up MainMenu.xib

5. In the IB File menu, do a "Reload All Class Files"

6. In the IB File menu, do a "Read Class File..." and select the App Delegate applescript file for this project.

THEN the outlet shows up properly.

I'm not sure about step 5. It might be OK to leave it out. But step 6 is absolutely necessary, at least for me.

Last edited by HippoMan (2009-09-19 12:45:57 am)

Offline

 

#12 2009-09-19 01:20:09 am

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5200

Re: Outlets not recognized.

You shouldn't have to do 5 or 6.

One thing that's easy to do, and gives the symptoms you're talking about, is to have one project open in Xcode, and another's .xib open in IB. I've done it, and it's very confusing.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/

Offline

 

#13 2009-09-19 02:23:19 pm

HippoMan
Member
Registered: 2008-09-18
Posts: 114

Re: Outlets not recognized.

Shane Stanley wrote:

You shouldn't have to do 5 or 6.

One thing that's easy to do, and gives the symptoms you're talking about, is to have one project open in Xcode, and another's .xib open in IB. I've done it, and it's very confusing.


Well, in my case, once I realized that I had issues with looking at the wrong files under IB, I made a point of always doing a Close Document in IB and then completely shutting it down before starting with a brand new Xcode project. And I still have this problem.

Here's an updated list of steps which reliably reproduce the problem on my 10.6.1 system with versions 3.2 of both Xcode and IB:

1. Open IB.

2. Go to IB's File menu and do a Close Document if it isn't greyed out.

3. Go to IB's FIle menu and do a Close.

4. Quit from IB.

5. Open Xcode and create a brand new Cocoa-AppleScript Application project.

6. Make sure the App Delegate has the following two lines right before the "on applicationWillFinishLaunching_(aNotification)" line:

Applescript:

property parent : class "NSObject"
property aOutlet : missing value

The app delegate should now look like this (assuming that the project is named NewTest):

Applescript:

script NewTestAppDelegate
   
   property parent : class "NSObject"
   
   property aOutlet : missing value
   
   on applicationWillFinishLaunching_(aNotification)
   end applicationWillFinishLaunching_
   
   on applicationShouldTerminate_(sender)
       return true
   end applicationShouldTerminate_
   
end script

7. Go to Xcode's File menu and do a Save. Do it again to make double-sure. Do it yet again to make triple-sure.

8. Open up MainMenu.xib

9. Control-click on the blue cube for the App Delegate.

In my case, I see the following (could someone tell me how to get the "[ img ] tag: off" setting set to "on" underneath this message posting window?). Note that my aOutlet does not appear:

MainMenu.xib.png


Only if I perform the following extra step does my aOutlet appear under Outlets:

10. In the IB File menu, do a "Read Class File..." and select the App Delegate applescript file for this project (in this example, it's the NewTestAppDelegate.applescript file within the NewTest project's top-level directory). Then, click on Open.

Without step 10, I have never gotten aOutlet to show up when I control-click on my App Delegate. What am I doing wrong?

Last edited by HippoMan (2009-09-19 02:39:24 pm)

Offline

 

#14 2009-09-19 08:18:13 pm

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5200

Re: Outlets not recognized.

That's odd. One thing to try: instead of double-clicking on MainMenu.xib in Xcode to open it, go into the Finder and double-click on it there. I have had a case where I threw out a project and started a new one with the same name, and the old .xib file was being opened.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/

Offline

 

#15 2009-09-20 01:26:23 am

HippoMan
Member
Registered: 2008-09-18
Posts: 114

Re: Outlets not recognized.

Thanks for this suggestion. I followed the steps above with a brand new project name that I never used before. This time, in step 8, I opened up MainMenu.xib by double-clicking on it in the Finder. Unfortunately, this didn't make a difference. I still had to perform step 10 before I saw aOutlet show up.

So I don't know what's causing this to occur for me. However, the "Read Class File..." step seems to take care of the problem, so even if that's the best I can do for now, at least I have a way to proceed.

Offline

 

#16 2009-09-20 12:59:09 pm

HippoMan
Member
Registered: 2008-09-18
Posts: 114

Re: Outlets not recognized.

Well, I finally fixed this problem, but I'm not sure how.

I shut down Xcode and Interface Builder, and then I deleted all plists, cached objects, and preference files and directories for both of these apps. However, that didn't fix the problem.

Then, I completely uninstalled Xcode and Interface Builder, and I then deleted all of the items mentioned above and reinstalled Xcode.  Again, this didn't fix the problem.

I then repeated all of the deletes and uninstalls. Then I shut down my machine and restarted, and then I repeated the reinstall of Xcode, and the problem still persisted.

Then I went to bed.

This morning, I redid the previous set of tasks yet again (delete, uninstall, shut down, restart, reinstall), and now, the problem is gone.

So clearly, my computer just wanted me to go away for a while. smile

All I can think of is that I must have messed up one or more of the above scenarios multiple times in a row, and that a good night's sleep made me more attentive to detail so that I finally did it all correctly in the morning. It's quite unlikely that I screwed it up that many times, but who knows?

In any case, all's well that ends well. Thanks again for all the help.

Excelsior!

Last edited by HippoMan (2009-09-20 01:39:34 pm)

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)