Novice having novice problems


#1

As the subject suggests I am having some issues with the CarLot project. The good thing is that I have gone over this and built it so many times that by now I have a very good sense of binding to controls using view-based table views. I build and run the application but the add button does not work. I have even copied meticulously the downloaded solution that does work. There is a difference though. I am using the latest version of xCode 4.6.1 and what I find are these constraints on everything.

vaughanprint.com/index.php/2 … nstraints/

I don’t know exactly what these constraints do or how to turn them off. My hunch is that they have no bearing on the fact that I can’t get CarLot to run and that they are there to anchor different elements in the GUI layout. If anyone has some suggestions it would be great. In the meantime I will move on to the next chapter.


#2

These constraints are part of Autolayout, a new layout system added with Mac OS X 10.7. The trouble is that recent versions of Xcode it defaults to On. Sometimes this can cause undesirable results with the layout of your app. To turn off Autolayout, select the XIB file (in this case the document xib file) and change to the file inspector. Uncheck “Use Autolayout”. This will remove the constraints.

Unless the constraints were causing the Add button to be hidden, this is likely not the reason that your add button isn’t working, however. What target/action do you have the add button connected to? Do you see any error messages in the debug output?


#3

Hi Adam,

Thanks for updating me on the new Auto layout checkbox. I have gone over the exercise again and when I run it the debug console says the following:

13 Foundation 0x00007fff82e1d186 __NSFireDelayedPerform + 392 14 CoreFoundation 0x00007fff8b5e2934 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20 15 CoreFoundation 0x00007fff8b5e2486 __CFRunLoopDoTimer + 534 16 CoreFoundation 0x00007fff8b5c2e11 __CFRunLoopRun + 1617 17 CoreFoundation 0x00007fff8b5c2486 CFRunLoopRunSpecific + 230 18 HIToolbox 0x00007fff862ce2bf RunCurrentEventLoopInMode + 277 19 HIToolbox 0x00007fff862d54bf ReceiveNextEventCommon + 181 20 HIToolbox 0x00007fff862d53fa BlockUntilNextEventMatchingListInMode + 62 21 AppKit 0x00007fff835d6779 _DPSNextEvent + 659 22 AppKit 0x00007fff835d607d -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 135 23 AppKit 0x00007fff835d29b9 -[NSApplication run] + 470 24 AppKit 0x00007fff8384eeac NSApplicationMain + 867 25 CarLot 0x00000001000014b2 main + 34 26 CarLot 0x0000000100001484 start + 52 27 ??? 0x0000000000000003 0x0 + 3 )

I normally persevere and hunt down the issue but for this one I am having no luck. I am currently making an inventory database with Filemaker Pro so I think my brain is all wired wrong at the moment.


#4

Ok two months later, database project done and dusted, near to 10 hour kip a night achieved I came afresh to Cocoa Programming, chapter 11 and very slowly did the exercise again and this time succeeded. Sometimes a lack of focused concentration can be the problem.

Cheers