Can't Read Firebase Data with Swift - ios

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
}

Related

Why do I get an "unrecognized selector" error with my IBAction?

I want to open a web page through a link. I'm using the address as a global variable. However, when I run a global function, an error occurs. What is the reason?
GlobalValue.swift
import Foundation
struct Global {
let apiAddress = "http://11.111.111.111:11111/"
let LinkURL: String
let LinkSecond : String
init()
{
agreeLinkURL = "User?type=webview"
agreeLinkSecond = "User2?type=webview"
}
func getURL() -> String {
return apiAddress + LinkURL
}
func getURLSecond() -> String {
return apiAddress + LinkSecond
}
}
Usage
let dataUrl = Global()
class ViewController: UIViewController {
...
#IBAction func DetailFuc(_ sender: Any) {
let detailUrl = dataUrl.getURL() // get error
print("***********************************************")
print(detailUrl)
print("***********************************************")
if let appURL = URL(string: detailUrl) {
UIApplication.shared.open(appURL) { success in
if success {
print("The URL was delivered successfully.")
} else {
print("The URL failed to open.")
}
}
} else {
print("Invalid URL specified.")
}
}
Error is:
2019-09-05 15:03:06.094723+0900 testap[24311:376425] -[testap.ViewController Detailfuc:]: unrecognized selector sent to instance 0x7ff27fe2d480
2019-09-05 15:03:06.102115+0900 testap[24311:376425] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[testap.ViewController Detailfuc:]: unrecognized selector sent to instance 0x7ff27fe2d480'
*** First throw call stack:
(
0 CoreFoundation 0x0000000105a618db __exceptionPreprocess + 331
1 libobjc.A.dylib 0x0000000103fb8ac5 objc_exception_throw + 48
2 CoreFoundation 0x0000000105a7fc94 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 UIKitCore 0x000000010f0bb235 -[UIResponder doesNotRecognizeSelector:] + 287
4 CoreFoundation 0x0000000105a66623 ___forwarding___ + 1443
5 CoreFoundation 0x0000000105a68418 _CF_forwarding_prep_0 + 120
6 UIKitCore 0x000000010f090624 -[UIApplication sendAction:to:from:forEvent:] + 83
7 UIKitCore 0x000000010eae58d5 -[UIControl sendAction:to:forEvent:] + 67
8 UIKitCore 0x000000010eae5bf2 -[UIControl _sendActionsForEvents:withEvent:] + 450
9 UIKitCore 0x000000010eae4ba8 -[UIControl touchesEnded:withEvent:] + 583
10 UIKitCore 0x000000010f0c94e6 -[UIWindow _sendTouchesForEvent:] + 2547
11 UIKitCore 0x000000010f0cabca -[UIWindow sendEvent:] + 4079
12 UIKitCore 0x000000010f0a930e -[UIApplication sendEvent:] + 356
13 UIKitCore 0x000000010f1792b3 __dispatchPreprocessedEventFromEventQueue + 3232
14 UIKitCore 0x000000010f17bbd9 __handleEventQueueInternal + 5911
15 CoreFoundation 0x00000001059c8db1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
16 CoreFoundation 0x00000001059c8633 __CFRunLoopDoSources0 + 243
17 CoreFoundation 0x00000001059c2cef __CFRunLoopRun + 1231
18 CoreFoundation 0x00000001059c24d2 CFRunLoopRunSpecific + 626
19 GraphicsServices 0x000000010a69f2fe GSEventRunModal + 65
20 UIKitCore 0x000000010f08efc2 UIApplicationMain + 140
21 testap 0x00000001035c31eb main + 75
22 libdyld.dylib 0x0000000107dcf541 start + 1
)
l
ibc++abi.dylib: terminating with uncaught exception of type NSException
Something must have been wrong when I set up a global variable, but I don't know what went wrong. Please let me know how to solve this. Is the method of calling a webpage the right way?
As you can see here:
reason: '-[testap.ViewController Detailfuc:]: unrecognized selector sent to instance 0x7ff27fe2d480'
That's not the issue. The reason of the crash is you renamed Detailfuc to DetailFuc with capital F. So it can not find the original function with lowercase f and crashed.
You should disconnect the wrong IBAction from the button eachtime you change the target.
You can right click on the button to see the connections and then click on x for the wrong connection with lowercase f
(reason: '-[testap.ViewController Detailfuc:]: unrecognized selector)
when you connect the outlet object in storyboard to it's code in the view controller, you can't modify the name any time before you disconnect it by right clicking on the object in story board and press on the x button that link the object with the code, and after modifying the name from code link it again.

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!

how to store an value in core data if an uibutton is pressed?

import UIKit
import CoreData
class ViewController: UIViewController {
#IBAction func btnGood(sender: AnyObject) {
var appDel:AppDelegate = (UIApplication.sharedApplication().delegate as! AppDelegate)
var context: NSManagedObjectContext = appDel.managedObjectContext
var record = NSEntityDescription.insertNewObjectForEntityForName("Meals", inManagedObjectContext: context) as NSManagedObject
record.setValue(1, forKey: "data")
do {
try context.save()
} catch {
print("error")
}
print(record)
print("Object Saved")
}
error -
2015-11-23 17:10:12.264 statsStoring[5355:669919] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unacceptable type of value for attribute: property = "data"; desired type = NSString; given type = __NSCFNumber; value = 1.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000101a3be65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010377adeb objc_exception_throw + 48
2 CoreData 0x00000001015d6990 _PFManagedObject_coerceValueForKeyWithDescription + 2864
3 CoreData 0x00000001015ae801 _sharedIMPL_setvfk_core + 177
4 statsStoring 0x00000001014c83ec _TFC12statsStoring14ViewController7btnGoodfS0_FPSs9AnyObject_T_ + 684
5 statsStoring 0x00000001014c8786 _TToFC12statsStoring14ViewController7btnGoodfS0_FPSs9AnyObject_T_ + 54
6 UIKit 0x000000010225c8c8 -[UIApplication sendAction:to:from:forEvent:] + 92
7 UIKit 0x00000001023cb328 -[UIControl sendAction:to:forEvent:] + 67
8 UIKit 0x00000001023cb5f4 -[UIControl _sendActionsForEvents:withEvent:] + 311
9 UIKit 0x00000001023ca724 -[UIControl touchesEnded:withEvent:] + 601
10 UIKit 0x00000001022cbbcf -[UIWindow _sendTouchesForEvent:] + 835
11 UIKit 0x00000001022cc904 -[UIWindow sendEvent:] + 865
12 UIKit 0x000000010227b29a -[UIApplication sendEvent:] + 263
13 UIKit 0x00000001022554cb _UIApplicationHandleEventQueue + 6844
14 CoreFoundation 0x0000000101967a31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
15 CoreFoundation 0x000000010195d95c __CFRunLoopDoSources0 + 556
16 CoreFoundation 0x000000010195ce13 __CFRunLoopRun + 867
17 CoreFoundation 0x000000010195c828 CFRunLoopRunSpecific + 488
18 GraphicsServices 0x00000001060b5ad2 GSEventRunModal + 161
19 UIKit 0x000000010225ad44 UIApplicationMain + 171
20 statsStoring 0x00000001014ca89d main + 109
21 libdyld.dylib 0x000000010429492d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
i want if the user pressed btngood button then '1 (true)' value should save in the 'data' attribute ! for this i tried 1 but its giving me an error and i know that its not the right way to do that
Agreed with first point of #Jan Greve. As log showing you are storing a number in string data type. Change this line
record.setValue(1, forKey: "data")
to
record.setValue("1", forKey: "data")
Firstly, it would be perfect if you edited your question to reflect the actual error you get, so we're not bound to guessing.
edit: With that error, it is clear that you use a NSNumber where your model expects a NSString. Use a String, not a number, or modify your model accordingly.
Secondly, to make sure you're not abusing KVC on NSManagedObjects and help the IDE helping you with completion, let it generate the NSManagedObject subclasses for your models and use them directly, e.g.
var record = Meals(
entity:
NSEntityDescription.entityForName("Meals", inManagedObjectContext:context),
insertIntoManagedObjectContext:
context)
record.data = 1
do {
try context.save()
} catch {
print("error")
}

Swift - Invalid top-level type in JSON write

I'm using Xcode 6.4 and swift 1.2 for my project. The problem is I can't parse my base64 pdf and load into webview. I got this error message when trying to parse the pdf.
Error message
2015-10-01 15:54:29.105 XXXXX[13605:417122] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSJSONSerialization dataWithJSONObject:options:error:]: Invalid top-level type in JSON write'
*** First throw call stack:
(
0 CoreFoundation 0x000000010ebfac65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010e4d7bb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010ebfab9d +[NSException raise:format:] + 205
3 Foundation 0x000000010e17471a +[NSJSONSerialization dataWithJSONObject:options:error:] + 264
4 SwiftyJSON 0x000000010dfb8327 _TFV10SwiftyJSON4JSON7rawDatafS0_FT7optionsVSC20NSJSONWritingOptions5errorGVSs33AutoreleasingUnsafeMutablePointerGSqCSo7NSError___GSqCSo6NSData_ + 183
5 XXXXX 0x000000010d69705c _TFFC4KPMG27VeritatDetailViewController11viewDidLoadFS0_FT_T_U_FTCSo12NSURLRequestGSqCSo17NSHTTPURLResponse_GSqPSs9AnyObject__GSqCSo7NSError__T_ + 796
6 Alamofire 0x000000010dc4af4e _TFFC9Alamofire7Request12responseJSONFDS0_FT7optionsVSC20NSJSONReadingOptions17completionHandlerFTCSo12NSURLRequestGSqCSo17NSHTTPURLResponse_GSqPSs9AnyObject__GSqCSo7NSError__T__DS0_U_FTS2_GSqS3__GSqPS4___GSqS5___T_ + 126
7 Alamofire 0x000000010dc46c53 _TFFFC9Alamofire7Request8responseFDS0_FT5queueGSqCSo8NSObject_10serializerFTCSo12NSURLRequestGSqCSo17NSHTTPURLResponse_GSqCSo6NSData__TGSqPSs9AnyObject__GSqCSo7NSError__17completionHandlerFTS2_GSqS3__GSqPS5___GSqS6___T__DS0_U_FT_T_U_FT_T_ + 403
8 Alamofire 0x000000010dc19527 _TTRXFo__dT__XFdCb__dT__ + 39
9 libdispatch.dylib 0x0000000111a7a186 _dispatch_call_block_and_release + 12
10 libdispatch.dylib 0x0000000111a99614 _dispatch_client_callout + 8
11 libdispatch.dylib 0x0000000111a81a1c _dispatch_main_queue_callback_4CF + 1664
12 CoreFoundation 0x000000010eb621f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
13 CoreFoundation 0x000000010eb23dcb __CFRunLoopRun + 2043
14 CoreFoundation 0x000000010eb23366 CFRunLoopRunSpecific + 470
15 GraphicsServices 0x0000000111ec5a3e GSEventRunModal + 161
16 UIKit 0x000000010f5fb8c0 UIApplicationMain + 1282
17 XXXXX 0x000000010d671887 main + 135
18 libdyld.dylib 0x0000000111acd145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
ViewController.swift
import UIKit
import Alamofire
import SwiftyJSON
class ViewController: UIViewController {
var datas: [JSON] = []
#IBOutlet var webView: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
Alamofire.request(.POST , "http://192.168.1.189/xxxxx/pdf.asmx/WSpdf", parameters:nil)
.responseJSON { request, response, json, error in
//println(json)
if json != nil {
var jsonObj = JSON(json!)
let jsonData:NSData = jsonObj[0]["Data"].rawData()!
self.displayPdf(jsonData)
}
}
}
func displayPdf(pdfContent: NSData){
var paths: NSArray = NSSearchPathForDirectoriesInDomains(.DocumentDirectory,.UserDomainMask, true)
var documentsDirectory: NSString = paths.objectAtIndex(0) as! NSString
var finalPath: NSString = documentsDirectory.stringByAppendingPathComponent("myPdf.pdf")
var url: NSURL = NSURL.fileURLWithPath(finalPath as String)!
pdfContent.writeToURL(url, atomically: true)
let requestObj = NSURLRequest(URL: url);
webView.loadRequest(requestObj);
}
}
Library that involve with this project.
Alamofire - https://github.com/Alamofire/Alamofire
SwiftyJSON - https://github.com/SwiftyJSON/SwiftyJSON
You should decode Base64 string with NSData initializer:
if let s = jsonObj[0]["Data"].string {
self.displayPdf(NSData(base64EncodedString: s, options: NSDataBase64DecodingOptions(rawValue: 0)))
}

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.

Resources