[UITableViewCellContentView af_cancelImageRequest]: Unrecognized selector sent to instance - uitableview

I need some help. I use AlamofireImage UIImageView extension to load some icons inside UITableView.
My project use some third party library written in Objective-C.
Code:
class TableCell: UITableViewCell {
#IBOutlet weak var logo: UIImageView!
#IBOutlet weak var name: UILabel!
func setData(provider: ServiceProvider) {
name.text = provider.name
let url = NSURL(string: provider.logoUrl)!
self.logo.af_setImageWithURL(url)
}
override func prepareForReuse() {
super.prepareForReuse()
logo.af_cancelImageRequest()
logo.layer.removeAllAnimations()
logo.image = nil
}
}
Error:
-[UITableViewCellContentView af_cancelImageRequest]: unrecognized selector sent to instance 0x787ea430
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewCellContentView af_cancelImageRequest]: unrecognized selector sent to instance 0x787ea430'
*** First throw call stack:
(
0 CoreFoundation 0x02eb1494 exceptionPreprocess + 180
1 libobjc.A.dylib 0x03d6ee02 objc_exception_throw + 50
2 CoreFoundation 0x02ebb253 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x02df089d ___forwarding_ + 1037
4 CoreFoundation 0x02df046e CF_forwarding_prep_0 + 14
5 AlamofireImage 0x005d324c _TFE14AlamofireImageCSo11UIImageView25af_setImageWithURLRequestfTP9Alamofire21URLRequestConvertible_16placeholderImageGSqCSo7UIImage_6filterGSqPS_11ImageFilter__8progressGSqFT9bytesReadVs5Int6414totalBytesReadS5_24totalExpectedBytesToReadS5__T__13progressQueuePSo17OS_dispatch_queue_15imageTransitionOES_S0_15ImageTransition26runImageTransitionIfCachedSb10completionGSqFGVS1_8ResponseS3_CSo7NSError_T___T + 476
6 AlamofireImage 0x005d2f85 TFE14AlamofireImageCSo11UIImageView18af_setImageWithURLfTCSo5NSURL16placeholderImageGSqCSo7UIImage_6filterGSqPS_11ImageFilter__8progressGSqFT9bytesReadVs5Int6414totalBytesReadS4_24totalExpectedBytesToReadS4__T__13progressQueuePSo17OS_dispatch_queue_15imageTransitionOES_S0_15ImageTransition26runImageTransitionIfCachedSb10completionGSqFGV9Alamofire8ResponseS2_CSo7NSError_T___T + 933

Related

Swift 3: -[_SwiftValue mergeType]: unrecognized selector sent to instance

I am getting a '-[_SwiftValue mergeType]: unrecognized selector sent to instance' error whenever I try to save a managed object context after doing a delete or an update of a record. For example:
context.delete(managedObject)
follow by
context.save()
and yes, context.save() is in a do-try-catch.
Records insert just fine, but the delete is throwing an exception. Stack trace is as follows:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_SwiftValue mergeType]: unrecognized selector sent to instance 0x60800005b0f0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010afac34b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010a5f021e objc_exception_throw + 48
2 CoreFoundation 0x000000010b01bf34 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x000000010af31c15 ___forwarding___ + 1013
4 CoreFoundation 0x000000010af31798 _CF_forwarding_prep_0 + 120
5 CoreData 0x000000010aae203a -[NSManagedObjectContext(_NSInternalAdditions) _validateObjects:forOperation:error:exhaustive:forSave:] + 1946
6 CoreData 0x000000010aae1836 -[NSManagedObjectContext(_NSInternalAdditions) _validateChangesForSave:] + 422
7 CoreData 0x000000010aae1476 -[NSManagedObjectContext(_NSInternalChangeProcessing) _prepareForPushChanges:] + 214
8 CoreData 0x000000010aaddeb2 -[NSManagedObjectContext save:] + 562
Trace starts right after it leaves my code.
Any insight would be helpful.
You may get this error when you use code like this, to set a merge policy:
context.mergePolicy = NSMergePolicyType.mergeByPropertyStoreTrumpMergePolicyType
Instead use this:
context.mergePolicy = NSMergePolicy(merge: .mergeByPropertyStoreTrumpMergePolicyType)

Thread:1 Signal SIGAGBRT

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!

[UICachedDeviceRGBColor stringByReplacingOccurrencesOfString:withString:]:

I've this error, when I try to use UIColor : [UICachedDeviceRGBColor stringByReplacingOccurrencesOfString:withString:]: unrecognized selector
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UICachedDeviceRGBColor stringByReplacingOccurrencesOfString:withString:]: unrecognized selector sent to instance 0x7f957952d870'
*** First throw call stack:
(
0 CoreFoundation 0x0000000103363d85 exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000102ac7deb objc_exception_throw + 48
2 CoreFoundation 0x000000010336cd3d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00000001032b2cfa ___forwarding_ + 970
The crash log says that you try send message to UICachedDeviceRGBColor class but it doesn't have method with name stringByReplacingOccurrencesOfString:withString: and it doesn't inherit from NSString. This method declare only in NSString class.

Can't Read Firebase Data with Swift

I am trying to create a simple Firebase application, and I have previously done so on Android. I am learning swift and was following the basic tutorials provided by Firebase.
I have successfully added Firebase through CocoaPods, however I am having trouble reading the result:
import UIKit
import Firebase
class ViewController: UIViewController {
#IBOutlet var mLabel: UILabel!
var myRootRef = Firebase(url:"https://ios-weather-practice.firebaseio.com")
override func viewDidLoad() {
super.viewDidLoad()
myRootRef.observeEventType(.Value, withBlock: {
snapshot in
if let baseResult = snapshot.value.objectForKey("ios-weather-practice") {
self.mLabel.text = baseResult as? String
}
})
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Error:
2016-04-14 16:37:06.424 Firebase Sample[1833:1735025] - [NSTaggedPointerString objectForKey:]: unrecognized selector sent to instance 0xa000000747365744
2016-04-14 16:37:06.432 Firebase Sample[1833:1735025] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSTaggedPointerString objectForKey:]: unrecognized selector sent to instance 0xa000000747365744'
*** First throw call stack:
(
0 CoreFoundation 0x00000001066f5f45 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000108419deb objc_exception_throw + 48
2 CoreFoundation 0x00000001066fe56d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010664beea ___forwarding___ + 970
4 CoreFoundation 0x000000010664ba98 _CF_forwarding_prep_0 + 120
5 Firebase Sample 0x0000000106367759 _TFFC15Firebase_Sample14ViewController11viewDidLoadFS0_FT_T_U_FGSQCSo13FDataSnapshot_T_ + 329
6 Firebase Sample 0x00000001063679f7 _TTRXFo_oGSQCSo13FDataSnapshot__dT__XFo_iGSQS___iT__ + 23
7 Firebase Sample 0x0000000106366d81 _TPA__TTRXFo_oGSQCSo13FDataSnapshot__dT__XFo_iGSQS___iT__ + 81
8 Firebase Sample 0x0000000106367a30 _TTRXFo_iGSQCSo13FDataSnapshot__iT__XFo_oGSQS___dT__ + 32
9 Firebase Sample 0x0000000106367a78 _TTRXFo_oGSQCSo13FDataSnapshot__dT__XFdCb_dGSQS___dT__ + 56
10 Firebase 0x00000001064316e1 __43-[FValueEventRegistration fireEvent:queue:]_block_invoke53 + 78
11 libdispatch.dylib 0x000000010980ae5d _dispatch_call_block_and_release + 12
12 libdispatch.dylib 0x000000010982b49b _dispatch_client_callout + 8
13 libdispatch.dylib 0x00000001098132af _dispatch_main_queue_callback_4CF + 1738
14 CoreFoundation 0x00000001066562e9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
15 CoreFoundation 0x00000001066178a9 __CFRunLoopRun + 2073
16 CoreFoundation 0x0000000106616e08 CFRunLoopRunSpecific + 488
17 GraphicsServices 0x000000010ace9ad2 GSEventRunModal + 161
18 UIKit 0x0000000106f1230d UIApplicationMain + 171
19 Firebase Sample 0x000000010636840d main + 109
20 libdyld.dylib 0x000000010985f92d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Firebase Database:
Observing by .Value will read in the entire contents of a node.
So if your structure is like this
myRootRef
iso-weather-practice: "sunny"
Your event will be ok and it could be read like this
self.mLabel.text = baseResult as? String
However, that's not usually how a Firebase structure would appear. It would be more like this
myRootRef
-JYa6s6gij900is
date: "20160413"
weather: "sunny"
-JY9398iias98o4
date: "20160414"
weather: "blowing snow"
and in that case. .Value will read in that entire node, and the snapshot will contain multiple nodes (as key:value pairs)
So here's how to handle it:
ref.observeEventType(.Value, withBlock: { snapshot in
for child in snapshot.children {
if let w = child.value.objectForKey("weather") as? String {
print(w)
}
}
})
output will be
sunny
blowing snow
Try this:
if let baseResult = snapshot.value as? String {
self.mLabel.text = baseResult
}

getting error if func is called (unrecognized selector sent to instance) swift

I created a function. This function is called by a button. If I press the button the app crashes and throws the following error:
2014-12-23 18:42:59.966 MyApp[8775:115552] -[MyApp.ViewController setDate]: unrecognized selector sent to instance 0x7fbbb9e458a0
2014-12-23 18:42:59.980 MyApp[8775:115552] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MyApp.ViewController setDate]: unrecognized selector sent to instance 0x7fbbb9e458a0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010451cf35 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000106060bb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010452404d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010447c27c ___forwarding___ + 988
4 CoreFoundation 0x000000010447be18 _CF_forwarding_prep_0 + 120
5 Foundation 0x00000001049512b4 __NSFireTimer + 83
6 CoreFoundation 0x0000000104484f64 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
7 CoreFoundation 0x0000000104484b25 __CFRunLoopDoTimer + 1045
8 CoreFoundation 0x0000000104447e5d __CFRunLoopRun + 1901
9 CoreFoundation 0x0000000104447486 CFRunLoopRunSpecific + 470
10 GraphicsServices 0x0000000106c289f0 GSEventRunModal + 161
11 UIKit 0x0000000104da8420 UIApplicationMain + 1282
12 MyApp 0x0000000103f6a08e top_level_code + 78
13 MyApp 0x0000000103f6a0ca main + 42
14 libdyld.dylib 0x0000000107834145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
this is the function which is crashing if it's called:
func setDate(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
switch editingStyle {
case .Delete:
let appDel:AppDelegate = UIApplication.sharedApplication().delegate as AppDelegate
let context:NSManagedObjectContext = appDel.managedObjectContext!
context.deleteObject(daten[indexPath.row] as NSManagedObject)
daten.removeAtIndex(indexPath.row)
context.save(nil)
self.tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
default:
let mySelectedCell:UITableViewCell = tableView.cellForRowAtIndexPath(indexPath)!
mySelectedCell.detailTextLabel?.text = dateLabel.text
self.sideBar.alpha = 0
return
}
}
This line tells you everything you need to know:
-[MyApp.ViewController setDate]: unrecognized selector sent to instance 0x7fbbb9e458a0
Your ViewController class doesn't have a method called setDate or a property called date.
As far as I can tell, the function you posted has nothing to do with this error. It never calls setDate.

Resources