Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Hamza Ansari
34 PointsTerminating with uncaught exception of type NSException
I'm getting this error in the debug area when I try to run my app:
2014-11-04 01:12:10.266 Juxta[61428:1162469] +[TtCFC5Juxta14ViewController11viewDidLoadFS0_FT_T_L_7Counter parseClassName]: unrecognized selector sent to class 0x10bdc5660 2014-11-04 01:12:10.269 Juxta[61428:1162469] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[_TtCFC5Juxta14ViewController11viewDidLoadFS0_FT_T_L_7Counter parseClassName]: unrecognized selector sent to class 0x10bdc5660' *** First throw call stack: ( 0 CoreFoundation 0x000000010d0223f5 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010eb50bb7 objc_exception_throw + 45 2 CoreFoundation 0x000000010d02940d +[NSObject(NSObject) doesNotRecognizeSelector:] + 205 3 CoreFoundation 0x000000010cf817fc _forwarding__ + 988 4 CoreFoundation 0x000000010cf81398 CF_forwarding_prep_0 + 120 5 Juxta 0x000000010bbec772 -[PFObject(Private) init] + 143 6 Juxta 0x000000010bbdf6d0 _TFCFC5Juxta14ViewController11viewDidLoadFS0_FT_T_L_7CountercfMS1_FT_S1 + 64 7 Juxta 0x000000010bbdf712 TFCFC5Juxta14ViewController11viewDidLoadFS0_FT_T_L_7CounterCfMS1_FT_S1 + 50 8 Juxta 0x000000010bbde187 TFC5Juxta14ViewController11viewDidLoadfS0_FT_T + 1575 9 Juxta 0x000000010bbde4d2 TToFC5Juxta14ViewController11viewDidLoadfS0_FT_T + 34 10 UIKit 0x000000010d9d1190 -[UIViewController loadViewIfRequired] + 738 11 UIKit 0x000000010d9d138e -[UIViewController view] + 27 12 UIKit 0x000000010d8f0db9 -[UIWindow addRootViewControllerViewIfPossible] + 58 13 UIKit 0x000000010d8f1152 -[UIWindow setHidden:forced:] + 276 14 UIKit 0x000000010d8fd65c -[UIWindow makeKeyAndVisible] + 42 15 UIKit 0x000000010d8a8191 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2628 16 UIKit 0x000000010d8aae5c -[UIApplication _runWithMainScene:transitionContext:completion:] + 1350 17 UIKit 0x000000010d8a9d22 -[UIApplication workspaceDidEndTransaction:] + 179 18 FrontBoardServices 0x00000001127512a3 __31-[FBSSerialQueue performAsync:]_block_invoke + 16 19 CoreFoundation 0x000000010cf57abc __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK_ + 12 20 CoreFoundation 0x000000010cf4d805 __CFRunLoopDoBlocks + 341 21 CoreFoundation 0x000000010cf4d5c5 __CFRunLoopRun + 2389 22 CoreFoundation 0x000000010cf4ca06 CFRunLoopRunSpecific + 470 23 UIKit 0x000000010d8a9799 -[UIApplication _run] + 413 24 UIKit 0x000000010d8ac550 UIApplicationMain + 1282 25 Juxta 0x000000010bbe0d3e top_level_code + 78 26 Juxta 0x000000010bbe0d7a main + 42 27 libdyld.dylib 0x000000010fbb2145 start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)
What exactly is wrong with my code? Here's my ViewController below:
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
var testObject = PFObject(className: "TestObject")
testObject["foo"] = "bar"
testObject.saveInBackgroundWithTarget(nil, selector: nil)
class Counter : PFObject {
var voteCount: Int = 0
func incrementBy(amount: Int, numberOfTimes times: Int) { voteCount += amount * times
println(" \(voteCount) votes")
}
}
var countOption1 = PFObject(className: "countOption1")
countOption1 = Counter()
countOption1.saveInBackgroundWithTarget(PFObject.self, selector: nil)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}