XCode - Interface builder : no link

Hello! I am new to ApplescriptObjC and I have the following problem: I create a new project with XCode, it opens my default class with its two methods (applicationWillFinishLaunching_ and applicationShouldTerminate_). I click on the MainMenu.xib and Interface Builder launch, presenting my default empty main window. If I add some objects, everything is fine: my app launches with its modified interface. Great.

I think “ok, let’s try these IBActions and Outlets”. But at this point, it’s getting worse: right-clicking my application blue cube in IB does not show me my default methods. And no way to add another one.

Tutorials opened in XCode work perfectly (their blue cube show the methods)…

Can somebody help me? I didn’t find any explanation (except the traditional “re-install the whole MacOS”, and other Windows-like suggestions).

Thank you!

Mac Pro, Snow Leopard 10.6.6, XCode 3.2.2, IB 3.2.5

Model: Mac Pro
Browser: Safari 533.19.4
Operating System: Mac OS X (10.6)

First of all welcome!

  1. It’s not that I want to treat you like a baby but did you save the class before you switched to IB?
  2. did you set the class of the blue cube to your own class
  3. did you set the properties (IBOutlets) of your script to missing value?
  4. did you use the syntax on actionName_(sender) to make your IBActions?

I think you missed step 2

Hello DJ! Thanks for your fast answer. I AM a baby in ApplescriptObjC, no offense! (I used Think Pascal for ten years, then I made some applications using XCode with applescript, so I’m not a really new programmer, but I learn s-l-o-w-l-y :slight_smile:

I did the following: create new project, name “AGAIN”. Code in XCode:

script AGAINAppDelegate
property parent : class “NSObject”

on applicationWillFinishLaunching_(aNotification)
	-- Insert code here to initialize your application before any files are opened 
end applicationWillFinishLaunching_

on applicationShouldTerminate_(sender)
	-- Insert code here to do any housekeeping before your application quits 
	return current application's NSTerminateNow
end applicationShouldTerminate_

end script.

In IB, My blue cube is from class “AGAINAppDelegate”. When right-clicked, it shows

App delegate

Referencing Outlets
delegate ← File’s Owner

(Full stop.)

shall I declare “aNotification” and “sender” as property: missing value?
Regards,
B.

No – you don’t want them to be properties, they hold arguments passed to the handlers. What you’re seeing is what you should be seeing.

G’day Shane! It’s a real pleasure to “speak” to you from the other side of the planet (Switzerland)! I just bought a copy of your excellent “ApplescriptObjC explored” - it was the “missing book” I was looking for!

But if (as I suspected) what I am seeing is correct, where is the bug? Did I made a mistake in a deeply buried option/preference of XCode and/or Interface Builder?

Thank you again,
Bernard.

You should see them listed under the heading Received Actions, above Referencing Outlets.

I’v ejust edited your code to:

script AGAINAppDelegate
    property parent : class "NSObject"
    property anOutlet : missing value --this is an outlet

    on applicationWillFinishLaunching_(aNotification) --this is an delegate
        -- Insert code here to initialize your application before any files are opened
    end applicationWillFinishLaunching_
   
    on applicationShouldTerminate_(sender) --this is an delegate
        -- Insert code here to do any housekeeping before your application quits
        return current application's NSTerminateNow
    end applicationShouldTerminate_

    on anIBAction_(sender) --this is an action
          
    end anIBAction_
end script

now when you right click in IB you will see more. I’ll hope my comments well clear some things out for you

Thank you both!

DJ, I’ve copied/pasted your code, IB tells the XCode file is OK (green light), confirms that AGAINAppDelegate is a subclass of NSObject, is defined in the MainMenu.xib file and… has neither outlets nor actions.

Everything happens as if XCode created the xib file with the correct name and class, but as if IB didn’t “see” the source file of the project. As if AGAINAppDelegate was just an empty subclass, like:

type
AGAINAppDelegate = object(NSObject)
end;

… well, I’m stuck.

So what happens if you open one of the samples from the book?

Tutorials opened in XCode work perfectly (their blue cube show the methods)… (???)

Of course I could try to restart from one of these and emptying IB objects and code from XCode BUT when I did this, I lost the entire project (XCode could not re-save the project). In fact, only MOVE a project folder in a real pain to get everything working again…

What version of Xcode are you using?

Snow Leopard 10.6.6, XCode 3.2.2, IB 3.2.5

Back under another name (the previous name, berfis, has disappered…)

After looking into the depth of the Web’s forums, I’ve found similar cases (link between Xcode and IB broken). The problem was never solved, despite of these numerous “Rebuild all your mac” and “On my side, it works” tips…

I pretend, after trying all possible solutions and re-buildings, that the problem is on the Apple side. You may object that it’s impossible (that’s more faith than reason) and maybe you’re right, BUT if a development platform forces an user to re-install its whole computer (platform and system) there IS a problem into the platform conception… :slight_smile:

Anyway, the “best” solution I found with the help of Shane Stanley is to log in as a different user, create the project, re-log under my main user and open the project. This time I get my methods listed when I right-click the blue cube of my Application Delegate…

But of course if you have a better solution, you’re welcome. Thanks to those helped me!

Bernard

Well it’s all simpler as you may think. If under another user everything works ok then there is something wrong inside the user’s folder for that user and has nothing to with system or xcode itself. Deleting all preferences and application data for Xcode and IB from your user folder should solve the problem then.

That was the first thing I suspected when I launched this thread, but could you tell me WHERE THEY ARE? Under my other user, the positions of the windows of IB show clearly there are different preferences – under my main user, after multiple re-installations, the positions remain the same (the Installer kindly preserves the preferences…).

(* Comment :
Of course I was used to drag into Trash the “Prefs” file installed into the “Preferences” folder of System 7… With this disk-consuming Unix conception of the System (4.66 Gb, 114’520 files in System folder!) I’ve never been sure to totally get rid of an application… Otherwise, there were no utilities like “Clean my Mac” or “Mac Keeper” on the Web.
*)

So how can I really be sure to re-initialize IB’s preferences? Thank you!

All true… The (default) preferences will be made when the application launches for the first time (this is how 99% of all applications for mac works) and is not part of an installation or whatsoever. Re-installation of a system is the last thing I should do. There are multiple places xcode and ib store data in your account.

~/Library/Preferences/com.apple.InterfaceBuilder3.LSSharedFileList.plist
~/Library/Preferences/com.apple.InterfaceBuilder3.plist
~/Library/Preferences/com.apple.xcode.plist
~/Library/Preferences/com.apple.iphonesimulator.plist
~/Library/Application Support/Apple/Developer Tools/
~/Library/Application Support/Xcode/
~/Library/Application Support/Interface Builder 3.0/
~/Library/Application Support/Developer/
~/Library/Application Support/iPhone Simulator/

You can delete all those files without any problem also be sure xcode and ib are not running. When starting up Xcode everything will be set as the first time you started it after installation. So everything you’ve changed after installation of Xcode and IB are gone. If that is a problem then try deleting the first two files and start xcode and ib.

~/Library/Preferences/com.apple.InterfaceBuilder3.LSSharedFileList.plist
~/Library/Preferences/com.apple.InterfaceBuilder3.plist
~/Library/Preferences/com.apple.xcode.plist
~/Library/Preferences/com.apple.iphonesimulator.plist
~/Library/Application Support/Interface Builder 3.0/
~/Library/Application Support/Developer/
~/Library/Application Support/iPhone Simulator/

do NOT exist on my disk! Once again, what’s happening?

Preference .plist files are not created until/unless you change one of the default preferences for that item.

Shane,

after opening Xcode ~/Library/Preferences/com.apple.xcode.plist will be created directly without changing anything. In this file are also stored things like window sizes. So when he’s saying he don’t have the file, he’s looking at the wrong place or there is something seriously wrong with his machine…

Fiz,

If it’s true that those files aren’t on your hard drive there could be something wrong with your privileges on your file system.

Ah, right – I forgot about preferences for UI things like window bounds.