Xcode AppDelegate wont link to textfields - appdelegate

I am following along in a book to learn swift and I am building a basic loan calculator for OS-X using XCode. I am getting two errors in my code and it wont allow me to attach the Outlets to my textfields. The errors are:
Line 16 - Use of Undeclared type "NSTestField" but I changed it to NSTextField and it still shows an error under the mistyped var name.
Line 35 - Postfix "." is reserved. The error carrot is on the dot between loanAmountField and doubleValue.
Also, it wont allow me to drag the outlets into my app. I am guessing I did not attach the appdelegate file to the right window since the window option is not marked but I cant figure out how to do that. The book just says it should already be marked.
My code showing errors
(Sorry, I tried using the "code sample" button when posting this but even after indenting 4 spaces and pasting my code it continued to tell me I did not indent.)
The appdelegate showing that "window" isnt marked

Related

Code Composer Studio MSPFR6989 variables&expressions won’t come up

I am using CCS to program a MSPFR6989 and I’ve debugged and the code is working but I can’t get variables or registers to come up. It remains blank. enter image description here
use double click onto your variables and choose watch expression. You can find your variables under expression from now. If it shows you its name but a red error message try step by step debugging, works for me everytime.

Unity 5 NetUI - How do I fix this error?

This error message keeps showing everytime I test the game:
NullReferenceException: Object reference not set to an instance of an object
SetupLocalPlayer.Start () (at Assets/Scripts/SetupLocalPlayer.cs:12)
and I'm trying to figure out how to enable my Wheeldrive script when I am the local player (When I spawn in) and it doesn't seem to be working, The Network Id is on the player prefab but the controller script is on the Sedan gameobject, since the Network identity is on the player prefab the disable script also has to go on it, so I don't think the script is able to find the controller script since its not on the same Gameobject. (Picture Below)
Any help is really appreciated :)
The Project + Code Picture
If the SetupLocalPlayer script is on the player prefab, You should be able to find the WheelDrive component using GetComponentInChildren<WheelDrive>() instead of GetComponent<WheelDrive>() (in line 12 of the SetupLocalPlayer.cs file)
Because the WheelDrive component is not enabled, GetComponent is unable to find it. Thus GetComponent<WheelDrive>() returns null, and you get the error in the console.

Window setBackGround: causes runtime errors

I added a background color to the window of a well-running simple draw project and build succeeded. Then the fun began: runtime errors appeared in the console window. I found no help in Apple docs and Google. When the same happened in another draw project, I knew I had to ask for help.
Here's what happened each time I did a build & debug and stop -- runs 1) through 4). "continue" means I clicked the Continue icon. It kept on erring in no consistent order.
1)Program received signal:“EXC_BAD_ACCESS". spinning ball. paths OK.
continue. “EXC_BAD_ACCESS. spinning ball. paths disappear. background appears.
2)continue, 6 times. “EXC_BAD_ACCESS”. spinning ball. paths disappear. background appears.
3)immediately:
2012-12-26 09:53:18.265 bezier triangle[388:a0f] -[NSCFArray stroke]: unrecognized selector sent to instance 0x1005184f0
2012-12-26 09:53:18.268 bezier triangle[388:a0f] -[NSCFArray stroke]: unrecognized selector sent to instance 0x1005184f0
2012-12-26 09:53:37.846 bezier triangle[388:a0f] -[NSCFArray stroke]: unrecognized selector sent to instance 0x1005184f0
2012-12-26 09:53:37.847 bezier triangle[388:a0f] -[NSCFArray stroke]: unrecognized selector sent to instance 0x1005184f0
no continue icon. paths OK. no background.
4)continue, 6 times. “EXC_BAD_ACCESS”. spinning ball. no paths. no background.
The NSWindow class creates a couple of Bezier paths in initWithRect: and draws them in drawRect:. It ran well.
I got the setBackGround: code from Apple's Window Programming Guide and pasted it into the previously empty AppDelegate.
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Background color
[window setOpaque:NO]; // YES by default
NSColor *semiTransparentBlue =
[NSColor colorWithDeviceRed:0.0 green:0.0 blue:1.0 alpha:0.5];
[window setBackgroundColor:semiTransparentBlue];
window.backgroundColor = NSColor.blueColor;
}
Setting breakpoints showed that the runtime errors occur after this code finishes.
Thinking that the problems might have something to do with the timing of its execution, I moved this code to initWithRect and then into awakeFromNib. These didn't work. I wish I could find some example that shows how to implement this. All help will be appreciated.
No, setBackground: did not cause the runtime errors.
In the paths code, the paths weren't being allocated and inited properly, although the project ran correctly until the setBackground: code was added. Strange!
I'm sorry I didn't enclose the paths code in my question because it was too long.
I found my mistakes by starting a new project and building it up slowly, a piece at a time.

Xcode 4 disable "fix-it" popup

I'm fine with Xcode 4 telling me that I have an error. But that pop-up pretty much always has the wrong solution. Is there any way I can get rid of it permanently?
From what I've seen, it looks like you may need to disable the various types of warnings one by one. A list is found here:
http://developer.apple.com/library/mac/#documentation/DeveloperTools/gcc-4.0.1/gcc/Warning-Options.html#Warning-Options
To change them:
Bring up the project navigator and choose your project. In the main window that appears, choose "All". Under the section "LLVM compiler 2.0 - Warnings", choose "Other Warning Flags". Add the flag "Wno-idiomatic-parentheses" for both "Debug" and "Release." Now clean and recompile ( from if(self = [super init]) - LLVM warning! How are you dealing with it?)
I noted in the apple dev link that the following option should inhibit all warnings:
-w Inhibit all warning messages.

Specflow error using TestDriven.Net - Couldn't Find Type

I'm trying out Specflow for the first time, and have created a VS2010 project with a reference to TechTalk.SpecFlow, as well as nunit.framework. I've added a sample Feature file:
Feature: Addition
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers
#mytag
Scenario: Add two numbers
Given I have entered 50 into the calculator
And I have entered 70 into the calculator
When I press add
Then the result should be 120 on the screen
When I execuyte the test (using TestDriven.Net), I get the following error:
Test 'T:SpecFlowFeature1' failed: Couldn't find type with name 'SpecFlowFeature1'
System.Exception: Couldn't find type with name 'SpecFlowFeature1'
at MutantDesign.Xml.Documentation.MemberInfoUtilities.FindMemberInfo(Assembly assembly, String cref)
at TestDriven.TestRunner.AdaptorTestRunner.Run(ITestListener testListener, ITraceListener traceListener, String assemblyPath, String testPath)
at TestDriven.TestRunner.ThreadTestRunner.Runner.Run()
Anyone know what I'm missing?
Actually traced this down to how I was running the test. Right clicking the ".feature" file (or anywhere within that file) and selecting "Run Tests" resulted in the error. Right clicking the underlying ".feature.cs" file and selecting "Run Tests" executed correctly. Looks like TestDriven.Net wasn't able to "understand" the "*.feature" file.
I typically start "Couldn't find type..." errors in my references folder and make sure that the library that I'm referencing is being referenced correctly and that the version that's being referenced isn't outdated.
Also, make sure that your SpecFlowFeature1 class isn't mistakenly declared as private. Visual Studio creates new classes (by default) as private and if you don't specify a class as public, it will remain private and not "visible" to outside projects.

Resources