Thread:1 Signal SIGAGBRT - ios

Why do I get a Thread:1 Signal SIGAGBRT within this code? I don't know what to change to fix the error. The application starts and as soon as I press the button the app cancels out and gives me an error.
import UIKit
class ViewController: UIViewController {
#IBOutlet var textFieldInput: UITextField!
#IBOutlet var laCelsius: UILabel!
#IBOutlet var laFahrenheit: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
#IBAction func btn(sender: UIButton) {
var c_out = 0.0
var f_out = 0.0
var inputValue = 0.0
let textInput = NSString(string: textFieldInput.text!)
inputValue = textInput.doubleValue
c_out = (inputValue-32)*5/9
f_out = inputValue * 1.8 + 32
self.laCelsius.text = NSString(format: "%3.2f" ,c_out) as String
self.laFahrenheit.text = NSString(format: "%3.2f" ,f_out) as String
}
}
this is the error code:
2016-09-22 14:15:51.669 DegreeCL[19045:1774964] -[DegreeCL.ViewController btnPressed:]: unrecognized selector sent to instance 0x7fa7bb643d40
2016-09-22 14:15:51.674 DegreeCL[19045:1774964] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[DegreeCL.ViewController btnPressed:]: unrecognized selector sent to instance 0x7fa7bb643d40'
*** First throw call stack:
(
0 CoreFoundation 0x000000010de1dd85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010fbc1deb objc_exception_throw + 48
2 CoreFoundation 0x000000010de26d3d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010dd6ccfa ___forwarding___ + 970
4 CoreFoundation 0x000000010dd6c8a8 _CF_forwarding_prep_0 + 120
5 UIKit 0x000000010e647a8d -[UIApplication sendAction:to:from:forEvent:] + 92
6 UIKit 0x000000010e7bae67 -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x000000010e7bb143 -[UIControl _sendActionsForEvents:withEvent:] + 327
8 UIKit 0x000000010e7ba263 -[UIControl touchesEnded:withEvent:] + 601
9 UIKit 0x000000010e6ba99f -[UIWindow _sendTouchesForEvent:] + 835
10 UIKit 0x000000010e6bb6d4 -[UIWindow sendEvent:] + 865
11 UIKit 0x000000010e666dc6 -[UIApplication sendEvent:] + 263
12 UIKit 0x000000010e640553 _UIApplicationHandleEventQueue + 6660
13 CoreFoundation 0x000000010dd43301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
14 CoreFoundation 0x000000010dd3922c __CFRunLoopDoSources0 + 556
15 CoreFoundation 0x000000010dd386e3 __CFRunLoopRun + 867
16 CoreFoundation 0x000000010dd380f8 CFRunLoopRunSpecific + 488
17 GraphicsServices 0x00000001124b3ad2 GSEventRunModal + 161
18 UIKit 0x000000010e645f09 UIApplicationMain + 171
19 DegreeCL 0x000000010dc38412 main + 114
20 libdyld.dylib 0x000000011068592d start + 1
21 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

The crucial information is
[DegreeCL.ViewController btnPressed:]: unrecognized selector sent to instance ...'
That means in Interface Builder there is somewhere a dead connection to an action btnPressed. Remove it.
You can search for btnPressed with ⇧⌘F.

SIGABRIT - signal is sent due to many reasons but in this case i think you have problem with Memory.
You should turn on All Exeptions with option of po $arg1 it will identify the error.

Select your button from interface builder, then select connection inspector from utilities and check that if you have extra connected action method should be there, remove it by clicking x and your issue will be solved!
It's should be btnPressed as per your crash log!

Related

unrecognized selector sent to instance 0x7fc4e9544fc0

This is the code that I tried running on Xcode and the idea is when I press the button, it will show the background and the logo, however when I press the button, it just leads me straight into the error
import UIKit
class ViewController: UIViewController {
#IBOutlet weak var coolLogo: UIImageView!
#IBOutlet weak var coolBg: UIImageView!
#IBOutlet weak var uncoolButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
#IBAction func makeMeNotSoUncoolButton(sender: AnyObject) {
coolLogo.hidden = false
coolBg.hidden = false
uncoolButton.hidden = true
print ("Its running")
}
}
This is the error that I got
2016-06-29 10:19:01.229 SuperCool[1950:40240] -
[SuperCool.ViewController uncoolButton:]: unrecognized selector sent to instance 0x7fc4e9544fc0
2016-06-29 10:19:01.238 SuperCool[1950:40240] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SuperCool.ViewController uncoolButton:]: unrecognized selector sent to instance 0x7fc4e9544fc0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010f617d85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001113bbdeb objc_exception_throw + 48
2 CoreFoundation 0x000000010f620d3d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010f566cfa ___forwarding___ + 970
4 CoreFoundation 0x000000010f5668a8 _CF_forwarding_prep_0 + 120
5 UIKit 0x000000010fe41a8d -[UIApplication sendAction:to:from:forEvent:] + 92
6 UIKit 0x000000010ffb4e67 -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x000000010ffb5143 -[UIControl _sendActionsForEvents:withEvent:] + 327
8 UIKit 0x000000010ffb4263 -[UIControl touchesEnded:withEvent:] + 601
9 UIKit 0x000000010feb499f -[UIWindow _sendTouchesForEvent:] + 835
10 UIKit 0x000000010feb56d4 -[UIWindow sendEvent:] + 865
11 UIKit 0x000000010fe60dc6 -[UIApplication sendEvent:] + 263
12 UIKit 0x000000010fe3a553 _UIApplicationHandleEventQueue + 6660
13 CoreFoundation 0x000000010f53d301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
14 CoreFoundation 0x000000010f53322c __CFRunLoopDoSources0 + 556
15 CoreFoundation 0x000000010f5326e3 __CFRunLoopRun + 867
16 CoreFoundation 0x000000010f5320f8 CFRunLoopRunSpecific + 488
17 GraphicsServices 0x0000000113cadad2 GSEventRunModal + 161
18 UIKit 0x000000010fe3ff09 UIApplicationMain + 171
19 SuperCool 0x000000010f432422 main + 114
20 libdyld.dylib 0x0000000111e7f92d start + 1
21 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Looks like you connected either the uncoolButton outlet or the makeMeNotSoUncoolButton action incorrectly.
Just place brakepoint in that method and check your self class and class of your button, than you will know what isn't as you expected. You can check class using method class, that returns instance of your clas, than just print it to log.

app crashing when trying to set a NSUserDefault with button

I'm creating an app and trying to update a NSUserDefault from a a different view controller, although i don't think its the separate view controller thats doing it because i can't set a new NSUserDefault on this controller either. its crashing whenever i push the button, heres the code from the view controller:
// Upgrades.swift
// Unit3Final
//
// Created by fgstu on 4/14/16.
// Copyright © 2016 AllenH. All rights reserved.
//
import UIKit
class Upgrades: UIViewController {
var tapModifier = (NSUserDefaults.standardUserDefaults().integerForKey("tapModifier"))
func storeTheScore() {
NSUserDefaults.standardUserDefaults().setInteger(tapModifier, forKey: "tapModifier")
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
#IBAction func BuyAHut(sender: UIButton) {
tapModifier += 5
storeTheScore()
}
}
it is set in my main view controller in my viewDidLoad with
var tapModifier: Int = 1
NSUserDefaults.standardUserDefaults().setInteger(tapModifier, forKey: "tapModifier")
and the error message is
2016-04-14 12:13:45.264 Unit3Final[40985:5120078] -[Unit3Final.Upgrades hutUpgrade:]: unrecognized selector sent to instance 0x7fadab4b2e80
2016-04-14 12:13:45.270 Unit3Final[40985:5120078] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Unit3Final.Upgrades hutUpgrade:]: unrecognized selector sent to instance 0x7fadab4b2e80'
*** First throw call stack:
(
0 CoreFoundation 0x000000010258de65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001042cddeb objc_exception_throw + 48
2 CoreFoundation 0x000000010259648d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00000001024e390a ___forwarding___ + 970
4 CoreFoundation 0x00000001024e34b8 _CF_forwarding_prep_0 + 120
5 UIKit 0x0000000102dac194 -[UIApplication sendAction:to:from:forEvent:] + 92
6 UIKit 0x0000000102f1b6fc -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x0000000102f1b9c8 -[UIControl _sendActionsForEvents:withEvent:] + 311
8 UIKit 0x0000000102f1aaf8 -[UIControl touchesEnded:withEvent:] + 601
9 UIKit 0x0000000102e1b49b -[UIWindow _sendTouchesForEvent:] + 835
10 UIKit 0x0000000102e1c1d0 -[UIWindow sendEvent:] + 865
11 UIKit 0x0000000102dcab66 -[UIApplication sendEvent:] + 263
12 UIKit 0x0000000102da4d97 _UIApplicationHandleEventQueue + 6844
13 CoreFoundation 0x00000001024b9a31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
14 CoreFoundation 0x00000001024af95c __CFRunLoopDoSources0 + 556
15 CoreFoundation 0x00000001024aee13 __CFRunLoopRun + 867
16 CoreFoundation 0x00000001024ae828 CFRunLoopRunSpecific + 488
17 GraphicsServices 0x0000000106bcdad2 GSEventRunModal + 161
18 UIKit 0x0000000102daa610 UIApplicationMain + 171
19 Unit3Final 0x000000010201db7d main + 109
20 libdyld.dylib 0x0000000104ddf92d start + 1
21 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
It doesn't have a value, that's why it's crashing, try setting it to 0 initially.
You're adding 5 to nothing, instead of this,
tapModifier = NSUserDefaults etc...
try...
tapModifier = 0

Swift Stopwatch App crashing, don't know where I'm going wrong

I am trying to make a stopwatch app for a coding class I am taking. I have no errors before I run the code, but once I run it it crashes after "build succeeds".
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
var timer = NSTimer()
var count = 0
func updateTime() {
count++
timeLabel.text = "\(count)"
}
#IBOutlet weak var timeLabel: UILabel!
#IBAction func playButton(sender: AnyObject) {
timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: Selector("updateTime"), userInfo: nil, repeats: true)
}
#IBAction func pauseButton(sender: AnyObject) {
}
#IBAction func resetButton(sender: AnyObject) {
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Here is the output console:
2015-07-23 12:52:26.877 Stop Watch[7472:467329] *** Terminating app
due to uncaught exception 'NSUnknownKeyException', reason:
'[<Stop_Watch.ViewController 0x7ffdf1435b60> setValue:forUndefinedKey:]:
this class is not key value coding-compliant for the key play.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010a814c65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010c37fbb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010a8148a9 -[NSException raise] + 9
3 Foundation 0x000000010ac32b53 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259
4 CoreFoundation 0x000000010a75cd50 -[NSArray makeObjectsPerformSelector:] + 224
5 UIKit 0x000000010b38b4eb -[UINib instantiateWithOwner:options:] + 1506
6 UIKit 0x000000010b1e36d8 -[UIViewController _loadViewFromNibNamed:bundle:] + 242
7 UIKit 0x000000010b1e3cc8 -[UIViewController loadView] + 109
8 UIKit 0x000000010b1e3f39 -[UIViewController loadViewIfRequired] + 75
9 UIKit 0x000000010b1e43ce -[UIViewController view] + 27
10 UIKit 0x000000010b0ff289 -[UIWindow addRootViewControllerViewIfPossible] + 58
11 UIKit 0x000000010b0ff64f -[UIWindow _setHidden:forced:] + 247
12 UIKit 0x000000010b10bde1 -[UIWindow makeKeyAndVisible] + 42
13 UIKit 0x000000010b0af417 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2732
14 UIKit 0x000000010b0b219e -[UIApplication _runWithMainScene:transitionContext:completion:] + 1349
15 UIKit 0x000000010b0b1095 -[UIApplication workspaceDidEndTransaction:] + 179
16 FrontBoardServices 0x000000010de7c5e5 __31-[FBSSerialQueue performAsync:]_block_invoke_2 + 21
17 CoreFoundation 0x000000010a74841c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
18 CoreFoundation 0x000000010a73e165 __CFRunLoopDoBlocks + 341
19 CoreFoundation 0x000000010a73df25 __CFRunLoopRun + 2389
20 CoreFoundation 0x000000010a73d366 CFRunLoopRunSpecific + 470
21 UIKit 0x000000010b0b0b02 -[UIApplication _run] + 413
22 UIKit 0x000000010b0b38c0 UIApplicationMain + 1282
23 Stop Watch 0x000000010a618fa7 main + 135
24 libdyld.dylib 0x000000010cab5145 start + 1
25 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
After looking at the console log, I am pretty sure the crash occurs because of a missing outlet connection.
Press Cmd+Shift+F and type 'play' in the search field.
Look for a entry in your storyboard file, of the form ...: Outlet = "play".
Click on that entry and remove it by clicking on the 'x' button next to play.
This should fix the crash.
Whenever you see an error of the form:
... this class is not key value coding-compliant for the key ...
you should check if there is a missing outlet in your storyboard or xib.

libc++abi.dylib: terminating with uncaught exception of type NSException on iOS 7.1

I am new to programming. I am going to learning iOS app development with the Apple new programming language Swift.
And I follow this site( https://developer.apple.com/swift/blog/?id=16 ) to start.
I copied the code from the video into my Xcode project. Anything was fine when I run the app in iOS 8.1 iOS simulator.
BUT I got exception while I choose iOS 7.1 iOS simulator. And I put the app into my iPhone 5S(iOS 7.1.2), it CRASHED.
Below is the code I copied from the video:
import UIKit
class ViewController: UIViewController {
#IBOutlet weak var photoImageView: UIImageView!
let context = CIContext(options: nil)
#IBAction func applyFilter(sender: AnyObject) {
let inputImage = CIImage(image: photoImageView.image)
let randomColor = [kCIInputAngleKey: (Double(arc4random_uniform(314)) / 100)]
let filteredImage = inputImage.imageByApplyingFilter("CIHueAdjust",withInputParameters: randomColor)
let renderedImage = context.createCGImage(filteredImage, fromRect: filteredImage.extent())
photoImageView.image = UIImage(CGImage: renderedImage)
}
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
Here is what I got from the console:
2014-11-03 16:17:30.645 njnj[2748:60b] -[CIImage imageByApplyingFilter:withInputParameters:]: unrecognized selector sent to instance 0x7fe4e3d165e0
2014-11-03 16:17:30.649 njnj[2748:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CIImage imageByApplyingFilter:withInputParameters:]: unrecognized selector sent to instance 0x7fe4e3d165e0'
*** First throw call stack:
(
0 CoreFoundation 0x0000000106c8b495 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010852799e objc_exception_throw + 43
2 CoreFoundation 0x0000000106d1c65d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x0000000106c7cd8d ___forwarding___ + 973
4 CoreFoundation 0x0000000106c7c938 _CF_forwarding_prep_0 + 120
5 njnj 0x0000000106b934a0 _TFC4njnj14ViewController11applyFilterfS0_FPSs9AnyObject_T_ + 3648
6 njnj 0x0000000106b93a66 _TToFC4njnj14ViewController11applyFilterfS0_FPSs9AnyObject_T_ + 54
7 UIKit 0x000000010753af06 -[UIApplication sendAction:to:from:forEvent:] + 80
8 UIKit 0x000000010753af06 -[UIApplication sendAction:to:from:forEvent:] + 80
9 UIKit 0x000000010753aeb4 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 17
10 UIKit 0x0000000107617880 -[UIControl _sendActionsForEvents:withEvent:] + 203
11 UIKit 0x0000000107616dc0 -[UIControl touchesEnded:withEvent:] + 530
12 UIKit 0x0000000107571d05 -[UIWindow _sendTouchesForEvent:] + 701
13 UIKit 0x00000001075726e4 -[UIWindow sendEvent:] + 925
14 UIKit 0x000000010754a29a -[UIApplication sendEvent:] + 211
15 UIKit 0x0000000107537aed _UIApplicationHandleEventQueue + 9579
16 CoreFoundation 0x0000000106c1ad21 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
17 CoreFoundation 0x0000000106c1a5f2 __CFRunLoopDoSources0 + 242
18 CoreFoundation 0x0000000106c3646f __CFRunLoopRun + 767
19 CoreFoundation 0x0000000106c35d83 CFRunLoopRunSpecific + 467
20 GraphicsServices 0x000000010baf2f04 GSEventRunModal + 161
21 UIKit 0x0000000107539e33 UIApplicationMain + 1010
22 njnj 0x0000000106b9582e top_level_code + 78
23 njnj 0x0000000106b9586a main + 42
24 libdyld.dylib 0x0000000108ee55fd start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
I hope someone can help me solve this problem.
(Sorry for my poor English)
Usually "unrecognized selector sent to instance" (resulting from -doesNotRecognizeSelector:) indicates a memory management issue, often an over-release of an object that is still referenced somewhere.
I suggest you run a debug build with memory debugging to triage your app's memory issues. I suggest you use ASan through recent versions of Xcode. If that's not an option, you can use malloc history with guard malloc, scribble, and NSZombies.

libc++abi.dylib: Terminating with uncaught exception of type NSException (lldb)

So I went back and re-wrote my code and made sure the parameters were all in the right place. But now, when I run my app in iOS Simulator, I get a Thread 1:signal SIGABRT error and the following error in my Debug area:
2014-11-04 00:39:12.288 Juxta[60526:1144351] +[_TtCFC5Juxta14ViewController11viewDidLoadFS0_FT_T_L_7Counter parseClassName]: unrecognized selector sent to class 0x1059bb640
2014-11-04 00:39:12.291 Juxta[60526:1144351] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[_TtCFC5Juxta14ViewController11viewDidLoadFS0_FT_T_L_7Counter parseClassName]: unrecognized selector sent to class 0x1059bb640'
*** First throw call stack:
(
0 CoreFoundation 0x0000000106c183f5 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000108746bb7 objc_exception_throw + 45
2 CoreFoundation 0x0000000106c1f40d +[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x0000000106b777fc ___forwarding___ + 988
4 CoreFoundation 0x0000000106b77398 _CF_forwarding_prep_0 + 120
5 Juxta 0x00000001057e2812 -[PFObject(Private) init] + 143
6 Juxta 0x00000001057d59f0 _TFCFC5Juxta14ViewController11viewDidLoadFS0_FT_T_L_7CountercfMS1_FT_S1_ + 64
7 Juxta 0x00000001057d5a32 _TFCFC5Juxta14ViewController11viewDidLoadFS0_FT_T_L_7CounterCfMS1_FT_S1_ + 50
8 Juxta 0x00000001057d44a7 _TFC5Juxta14ViewController11viewDidLoadfS0_FT_T_ + 1575
9 Juxta 0x00000001057d47f2 _TToFC5Juxta14ViewController11viewDidLoadfS0_FT_T_ + 34
10 UIKit 0x00000001075c7190 -[UIViewController loadViewIfRequired] + 738
11 UIKit 0x00000001075c738e -[UIViewController view] + 27
12 UIKit 0x00000001074e6db9 -[UIWindow addRootViewControllerViewIfPossible] + 58
13 UIKit 0x00000001074e7152 -[UIWindow _setHidden:forced:] + 276
14 UIKit 0x00000001074f365c -[UIWindow makeKeyAndVisible] + 42
15 UIKit 0x000000010749e191 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2628
16 UIKit 0x00000001074a0e5c -[UIApplication _runWithMainScene:transitionContext:completion:] + 1350
17 UIKit 0x000000010749fd22 -[UIApplication workspaceDidEndTransaction:] + 179
18 FrontBoardServices 0x000000010c3472a3 __31-[FBSSerialQueue performAsync:]_block_invoke + 16
19 CoreFoundation 0x0000000106b4dabc __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
20 CoreFoundation 0x0000000106b43805 __CFRunLoopDoBlocks + 341
21 CoreFoundation 0x0000000106b435c5 __CFRunLoopRun + 2389
22 CoreFoundation 0x0000000106b42a06 CFRunLoopRunSpecific + 470
23 UIKit 0x000000010749f799 -[UIApplication _run] + 413
24 UIKit 0x00000001074a2550 UIApplicationMain + 1282
25 Juxta 0x00000001057d6e7e top_level_code + 78
26 Juxta 0x00000001057d6eba main + 42
27 libdyld.dylib 0x00000001097a8145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Here's my code just so it's more clear:
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.
}
}
Any hint as to what could be wrong with my code? I was very careful this time.
You must have made some copy and paste mistake. There is no reason, for example, that:
class Counter is defined inside a UIViewController
class Counter has a didReceiveMemoryWarning function
Another class Counter in countOption1 function.
It is a mess

Resources