Need help. receiving below error while launching the application
Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Application windows are expected to have a root view controller at the end of application launch
Native stack trace:
0 CoreFoundation 0x00000001160421e6 exceptionPreprocess + 294
1 libobjc.A.dylib 0x0000000116fdf031 objc_exception_throw + 48
2 CoreFoundation 0x0000000116047472 +[NSException raise:format:arguments:] + 98
3 Foundation 0x0000000114f7b652 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
4 UIKit 0x0000000112d1bb96 -[UIApplication _runWithMainScene:transitionContext:completion:] + 3064
5 UIKit 0x00000001130dde4a __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 866
6 UIKit 0x00000001134b0909 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
7 UIKit 0x00000001130dda86 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236
8 UIKit 0x00000001130de2a7 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 675
9 UIKit 0x0000000113a4f4d4 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 299
10 UIKit 0x0000000113a4f36e -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433
11 UIKit 0x000000011373362d __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 221
12 UIKit 0x000000011392e387 _performActionsWithDelayForTransitionContext + 100
13 UIKit 0x00000001137334f7 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
14 UIKit 0x00000001134affb0 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
15 UIKit 0x0000000112d19f0c -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515
16 UIKit 0x00000001132eca97 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
17 FrontBoardServices 0x000000011d9c32f3 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 331
18 FrontBoardServices 0x000000011d9cbcfa __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 225
19 libdispatch.dylib 0x0000000117c74779 _dispatch_client_callout + 8
20 libdispatch.dylib 0x0000000117c79931 _dispatch_block_invoke_direct + 317
21 FrontBoardServices 0x000000011d9f7470 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 24
22 FrontBoardServices 0x000000011d9f712e -[FBSSerialQueue _performNext] + 439
23 FrontBoardServices 0x000000011d9f768e -[FBSSerialQueue _performNextFromRunLoopSource] + 45
24 CoreFoundation 0x0000000115fe4bb1 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
25 CoreFoundation 0x0000000115fc94af __CFRunLoopDoSources0 + 271
26 CoreFoundation 0x0000000115fc8a6f __CFRunLoopRun + 1263
27 CoreFoundation 0x0000000115fc830b CFRunLoopRunSpecific + 635
28 GraphicsServices 0x0000000119779a73 GSEventRunModal + 62
29 UIKit 0x0000000112d1d0b7 UIApplicationMain + 159
30 ??? 0x000000013437347e 0x0 + 5171000446
31 ??? 0x0000000134373213 0x0 + 5170999827
Application windows are expected to have a root view controller at the end of application
It seems that you didn't set the RootViewController.It worked fine in old version.But in the new version ,you should set it in AppDelegate
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
{
// Override point for customization after application launch.
// If not required for your application you can safely delete this method
var indexVC = new XXXViewController ();//your viewcontroller
Window = new UIWindow ((CGRect)UIScreen.MainScreen.Bounds);
Window .RootViewController = indexVC;
Window .MakeKeyAndVisible ();
return true;
}
Related
The problem started with the XCode 10.2.x as I guess
While it was working fine with the XCode 10.1
The crash point is "pdfView.frame = self.view.frame" from below code:
import UIKit
import PDFKit
class ViewController: UIViewController {
var pdfView = PDFView()
override func viewDidLoad() {
super.viewDidLoad()
// Prepare document to show
let url = Bundle.main.url(forResource: "sample", withExtension: "pdf")
let pdfDocument = PDFDocument(url: url!)
// PDFView
pdfView = PDFView()
pdfView.frame = self.view.frame
pdfView.autoScales = true
pdfView.document = pdfDocument
// Add PDFView to viewController
self.view.addSubview(pdfView)
}
}
Crash Log:
2019-05-20 16:24:39.269219+0530 PDFKitDemo[6795:305736] *** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]'
*** First throw call stack:
(
0 CoreFoundation 0x00000001118c06fb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x000000010fd63ac5 objc_exception_throw + 48
2 CoreFoundation 0x00000001118c0555 +[NSException raise:format:] + 197
3 QuartzCore 0x00000001149632ae _ZN2CA5Layer12set_positionERKNS_4Vec2IdEEb + 140
4 QuartzCore 0x000000011495268b -[CALayer setPosition:] + 57
5 QuartzCore 0x0000000114952de3 -[CALayer setFrame:] + 560
6 PDFKit 0x00000001106c7097 -[PDFPageLayerTile initWithFrame:forPageLayer:withRenderingTransform:tileContentsScale:generationID:] + 168
7 PDFKit 0x00000001106cc805 -[PDFPageLayer _updateTiles] + 3439
8 PDFKit 0x00000001106c7d8e -[PDFPageLayer setNeedsTilesUpdate] + 87
9 PDFKit 0x00000001106dc97d -[PDFPageView setNeedsTilesUpdate] + 48
10 PDFKit 0x00000001106de816 -[PDFPageView setFrame:] + 334
11 PDFKit 0x00000001106d511c -[PDFDocumentView createPageViewForPageAtIndex:] + 764
12 PDFKit 0x00000001106d6326 -[PDFDocumentView updateVisibility] + 1726
13 PDFKit 0x000000011074576f -[PDFView resizeDisplayView:] + 517
14 PDFKit 0x000000011073ecdf -[PDFView layoutDocumentView] + 464
15 PDFKit 0x000000011073a36a -[PDFView setDocument:waitDuration:] + 1246
16 PDFKitDemo 0x000000010f4833b3 $s10PDFKitDemo14ViewControllerC11viewDidLoadyyF + 2147
17 PDFKitDemo 0x000000010f483874 $s10PDFKitDemo14ViewControllerC11viewDidLoadyyFTo + 36
18 UIKitCore 0x000000011666843b -[UIViewController loadViewIfRequired] + 1183
19 UIKitCore 0x0000000116668868 -[UIViewController view] + 27
20 UIKitCore 0x0000000116ca0c33 -[UIWindow addRootViewControllerViewIfPossible] + 122
21 UIKitCore 0x0000000116ca1327 -[UIWindow _setHidden:forced:] + 289
22 UIKitCore 0x0000000116cb3f86 -[UIWindow makeKeyAndVisible] + 42
23 UIKitCore 0x0000000116c63f1c -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4555
24 UIKitCore 0x0000000116c690c6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1617
25 UIKitCore 0x00000001164ae6d6 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 904
26 UIKitCore 0x00000001164b6fce +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
27 UIKitCore 0x00000001164ae2ec -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236
28 UIKitCore 0x00000001164aec48 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1091
29 UIKitCore 0x00000001164acfba __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 782
30 UIKitCore 0x00000001164acc71 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433
31 UIKitCore 0x00000001164b19b6 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 576
32 UIKitCore 0x00000001164b2610 _performActionsWithDelayForTransitionContext + 100
33 UIKitCore 0x00000001164b171d -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
34 UIKitCore 0x00000001164b66d0 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
35 UIKitCore 0x0000000116c679a8 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 514
36 UIKitCore 0x000000011681edfa -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
37 FrontBoardServices 0x000000011cb5b125 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448
38 FrontBoardServices 0x000000011cb64ed6 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 283
39 FrontBoardServices 0x000000011cb64700 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53
40 libdispatch.dylib 0x0000000112c53db5 _dispatch_client_callout + 8
41 libdispatch.dylib 0x0000000112c572ba _dispatch_block_invoke_direct + 300
42 FrontBoardServices 0x000000011cb96146 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
43 FrontBoardServices 0x000000011cb95dfe -[FBSSerialQueue _performNext] + 451
44 FrontBoardServices 0x000000011cb96393 -[FBSSerialQueue _performNextFromRunLoopSource] + 42
45 CoreFoundation 0x0000000111827be1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
46 CoreFoundation 0x0000000111827463 __CFRunLoopDoSources0 + 243
47 CoreFoundation 0x0000000111821b1f __CFRunLoopRun + 1231
48 CoreFoundation 0x0000000111821302 CFRunLoopRunSpecific + 626
49 GraphicsServices 0x0000000119d422fe GSEventRunModal + 65
50 UIKitCore 0x0000000116c6aba2 UIApplicationMain + 140
51 PDFKitDemo 0x000000010f484a6b main + 75
52 libdyld.dylib 0x0000000112cc8541 start + 1
53 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Don't the exact reason but by adding the method viewDidLayoutSubviews, it's fixed the crash problem.
Now, working code is
override func viewDidLoad() {
super.viewDidLoad()
// Prepare document to show
let url = Bundle.main.url(forResource: "sample", withExtension: "pdf")
let pdfDocument = PDFDocument(url: url!)
// PDFView
pdfView = PDFView()
pdfView.autoScales = true
pdfView.document = pdfDocument
// Add PDFView to viewController
self.view.addSubview(pdfView)
}
override func viewDidLayoutSubviews() {
pdfView.frame = self.view.frame
}
I am working on a Swift project in Xcode v6.1.1, and I am getting the following error that I don't understand. I believe there is a problem with a couple of the Labels in my Main.storyboard and/or the UILabel variable I have them connected to.
I have tried everything I can find to fix it, and nothing has worked.
Any help would be appreciated.
2015-03-02 19:43:14.854 Final Project[7380:250494] -[UILabel longValue]: unrecognized selector sent to instance 0x7b8e1810
2015-03-02 19:43:14.876 Final Project[7380:250494] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UILabel longValue]: unrecognized selector sent to instance 0x7b8e1810'
*** First throw call stack:
(
0 CoreFoundation 0x00686946 __exceptionPreprocess + 182
1 libobjc.A.dylib 0x02062a97 objc_exception_throw + 44
2 CoreFoundation 0x0068e5c5 -[NSObject(NSObject) doesNotRecognizeSelector:] + 277
3 CoreFoundation 0x005d73e7 ___forwarding___ + 1047
4 CoreFoundation 0x005d6fae _CF_forwarding_prep_0 + 14
5 Foundation 0x00b0b6dc _NSSetLongValueForKeyWithMethod + 69
6 Foundation 0x00a691c6 _NSSetUsingKeyValueSetter + 257
7 Foundation 0x00a690bd -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
8 Foundation 0x00a9e9a6 -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 386
9 UIKit 0x011cf649 -[UIRuntimeOutletConnection connect] + 106
10 libobjc.A.dylib 0x02078724 -[NSObject performSelector:] + 62
11 CoreFoundation 0x005c05dc -[NSArray makeObjectsPerformSelector:] + 316
12 UIKit 0x011ce10a -[UINib instantiateWithOwner:options:] + 1775
13 UIKit 0x00ff0624 -[UIViewController _loadViewFromNibNamed:bundle:] + 270
14 UIKit 0x00ff0dbb -[UIViewController loadView] + 295
15 UIKit 0x00ff0fef -[UIViewController loadViewIfRequired] + 78
16 UIKit 0x00ff1595 -[UIViewController view] + 35
17 UIKit 0x01664707 -[_UIFullscreenPresentationController _setPresentedViewController:] + 75
18 UIKit 0x00fc6a81 -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 113
19 UIKit 0x00ffea61 -[UIViewController _presentViewController:withAnimationController:completion:] + 2102
20 UIKit 0x010015d2 __62-[UIViewController presentViewController:animated:completion:]_block_invoke + 345
21 UIKit 0x01001424 -[UIViewController presentViewController:animated:completion:] + 224
22 UIKit 0x010060be -[UIViewController _showViewController:withAction:sender:] + 213
23 UIKit 0x012423b5 -[UIStoryboardShowSegue perform] + 143
24 UIKit 0x014b6b49 -[UIStoryboardSegueTemplate _perform:] + 217
25 UIKit 0x014b6bc5 -[UIStoryboardSegueTemplate perform:] + 116
26 libobjc.A.dylib 0x020787cd -[NSObject performSelector:withObject:withObject:] + 84
27 UIKit 0x00e9b23d -[UIApplication sendAction:to:from:forEvent:] + 99
28 UIKit 0x00e9b1cf -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 64
29 UIKit 0x00fcee86 -[UIControl sendAction:to:forEvent:] + 69
30 UIKit 0x00fcf2a3 -[UIControl _sendActionsForEvents:withEvent:] + 598
31 UIKit 0x00fce50d -[UIControl touchesEnded:withEvent:] + 660
32 UIKit 0x00eeb60a -[UIWindow _sendTouchesForEvent:] + 874
33 UIKit 0x00eec0e5 -[UIWindow sendEvent:] + 791
34 UIKit 0x00eb1549 -[UIApplication sendEvent:] + 242
35 UIKit 0x00ec137e _UIApplicationHandleEventFromQueueEvent + 20690
36 UIKit 0x00e95b19 _UIApplicationHandleEventQueue + 2206
37 CoreFoundation 0x005aa1df __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
38 CoreFoundation 0x0059fced __CFRunLoopDoSources0 + 253
39 CoreFoundation 0x0059f248 __CFRunLoopRun + 952
40 CoreFoundation 0x0059ebcb CFRunLoopRunSpecific + 443
41 CoreFoundation 0x0059e9fb CFRunLoopRunInMode + 123
42 GraphicsServices 0x0441a24f GSEventRunModal + 192
43 GraphicsServices 0x0441a08c GSEventRun + 104
44 UIKit 0x00e998b6 UIApplicationMain + 1526
45 Final Project 0x000e904e top_level_code + 78
46 Final Project 0x000e908b main + 43
47 libdyld.dylib 0x027cfac9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Have you forgot a : in the string name?
Is your class marked with #objc?
Just by looking at -[UILabel longValue]: unrecognized selector sent to instance 0x7b8e1810 gives me the answer. You are treating a UILabel as an NSString.
Somewhere in your code you have [label longValue] where you mean to have [label.text longValue].
After looking at more of your call stack. I can see that it's happening while a while initializing a view controller from a storyboard.
Have you subclassed any views? It looks like you might have inadvertently changed the type of a property from NSString to UILabel.
So... I fixed the problem. Turned out the answer was right in front of me the whole time (it usually is). The Label that couldn't be initialized had the same name as an Int variable I had declared in the same class, only with the first letter capitalized. For some reason, I assumed it was case-sensitive, so that wouldn't matter...
I'm testing Swift in a simple Mac app. I got a NSToolbar in Storyboard and draw a NSSearchfield inside. The NSSearchfiled is connected to the First Responder's method controlTextDidChange (the first responder is the ViewController where I added NSTextFieldDelegate).
This is the method:
#IBAction override func controlTextDidChange(obj: NSNotification!) {
println("searching...")
println(obj.object.stringValue)
}
The method gets correctly called every time a new character is searched and the app does not crash however what's being returned is the following:
searching...
2014-08-03 09:56:57.770 TestApp[1129:24219] -[NSSearchField object]: unrecognized selector sent to instance 0x6080001a07e0
2014-08-03 09:56:57.770 TestApp[1129:24219] -[NSSearchField object]: unrecognized selector sent to instance 0x6080001a07e0
2014-08-03 09:56:57.775 TestApp[1129:24219] (
0 CoreFoundation 0x00007fff92e6af1c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff930ae74e objc_exception_throw + 43
2 CoreFoundation 0x00007fff92e6de4d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00007fff92db63c4 ___forwarding___ + 1028
4 CoreFoundation 0x00007fff92db5f38 _CF_forwarding_prep_0 + 120
5 TestApp 0x000000010000c187 _TFC9TestApp14ViewController20controlTextDidChangefS0_FGSQCSo14NSNotification_T_ + 231
6 TestApp 0x000000010000c582 _TToFC9TestApp14ViewController20controlTextDidChangefS0_FGSQCSo14NSNotification_T_ + 66
7 libsystem_trace.dylib 0x00007fff9117bc07 _os_activity_initiate + 75
8 AppKit 0x00007fff8d52b168 -[NSApplication sendAction:to:from:] + 410
9 AppKit 0x00007fff8d52af90 -[NSControl sendAction:to:] + 86
10 AppKit 0x00007fff8d6faf91 __26-[NSCell _sendActionFrom:]_block_invoke + 131
11 libsystem_trace.dylib 0x00007fff9117bc07 _os_activity_initiate + 75
12 AppKit 0x00007fff8d57329e -[NSCell _sendActionFrom:] + 144
13 AppKit 0x00007fff8d92fe8f __64-[NSSearchFieldCell(NSSearchFieldCell_Local) _sendPartialString]_block_invoke + 63
14 libsystem_trace.dylib 0x00007fff9117bc07 _os_activity_initiate + 75
15 AppKit 0x00007fff8d92fe47 -[NSSearchFieldCell(NSSearchFieldCell_Local) _sendPartialString] + 186
16 Foundation 0x00007fff932ee3d3 __NSFireTimer + 95
17 CoreFoundation 0x00007fff92dbf464 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
18 CoreFoundation 0x00007fff92dbf0f3 __CFRunLoopDoTimer + 1059
19 CoreFoundation 0x00007fff92e320fd __CFRunLoopDoTimers + 301
20 CoreFoundation 0x00007fff92d7b4d2 __CFRunLoopRun + 2018
21 CoreFoundation 0x00007fff92d7aaa8 CFRunLoopRunSpecific + 296
22 HIToolbox 0x00007fff90adcaff RunCurrentEventLoopInMode + 235
23 HIToolbox 0x00007fff90adc872 ReceiveNextEventCommon + 431
24 HIToolbox 0x00007fff90adc6b3 _BlockUntilNextEventMatchingListInModeWithFilter + 71
25 AppKit 0x00007fff8d35c2a5 _DPSNextEvent + 1000
26 AppKit 0x00007fff8d35ba79 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 139
27 AppKit 0x00007fff8d34fad3 -[NSApplication run] + 594
28 AppKit 0x00007fff8d33b2de NSApplicationMain + 1778
29 TestApp 0x000000010000da72 top_level_code + 34
30 TestApp 0x000000010000daaa main + 42
31 libdyld.dylib 0x00007fff8cb765c9 start + 1
32 ??? 0x0000000000000003 0x0 + 3
)
I can't figure out where the "unrecognized selector sent to instance" comes from.
controlTextDidChange method expects NSSearchField!, not NSNotification!.
Replace
#IBAction override func controlTextDidChange(obj: NSNotification!) {
println("searching...")
println(obj.object.stringValue)
}
with
#IBAction override func controlTextDidChange(obj: NSSearchField!) {
println("searching...")
println(obj.stringValue)
}
Solved by defining a custom method
#IBAction func controlTextDidChange_Custom(obj: NSSearchField!) {
if (!obj.stringValue.isEmpty) {
println("Searched: \(obj.stringValue)")
} else {
println("EMPTY")
}
}
I'm trying to develop a Mapkit app. There is a map, a lot of annotations located on this map. If I touch one of these annotations my app is displaying a custom popover from a storyboard. If I touch another location on view while popover is active, popover disappears without any problem.
But, if I touch one of annotation and move my finger out of annotation without releasing my finger, I got the error.
2014-08-01 11:33:34.160 notamTR[1101:60b] *** Terminating app due to uncaught exception 'NSGenericException', reason: '-[UIPopoverController dealloc] reached while popover is still visible.'
*** First throw call stack:
(
0 CoreFoundation 0x01b231e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x018208e5 objc_exception_throw + 44
2 CoreFoundation 0x01b22fbb +[NSException raise:format:] + 139
3 UIKit 0x00ae195e -[UIPopoverController dealloc] + 86
4 libobjc.A.dylib 0x01831692 _ZN11objc_object17sidetable_releaseEb + 268
5 libobjc.A.dylib 0x01830e81 objc_release + 49
6 myMap 0x0000b82d -[ViewController mapView:didSelectAnnotationView:] + 1885
7 MapKit 0x0017799d -[MKMapView annotationManager:didSelectAnnotationRepresentation:] + 704
8 MapKit 0x001ae9b8 -[MKAnnotationManager selectAnnotation:animated:avoid:] + 715
9 MapKit 0x001ae6e8 -[MKAnnotationManager selectAnnotation:animated:] + 75
10 MapKit 0x00165206 -[MKMapView handleLongPress:] + 993
11 UIKit 0x0087c4f4 _UIGestureRecognizerSendActions + 230
12 UIKit 0x0087b168 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 383
13 UIKit 0x0087cbdd -[UIGestureRecognizer _delayedUpdateGesture] + 60
14 UIKit 0x0088013d ___UIGestureRecognizerUpdate_block_invoke + 57
15 UIKit 0x008800be _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 317
16 UIKit 0x008767ac _UIGestureRecognizerUpdate + 199
17 UIKit 0x00521a5a -[UIWindow _sendGesturesForEvent:] + 1291
18 UIKit 0x00522971 -[UIWindow sendEvent:] + 1021
19 UIKit 0x004f45f2 -[UIApplication sendEvent:] + 242
20 UIKit 0x004de353 _UIApplicationHandleEventQueue + 11455
21 CoreFoundation 0x01aac77f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
22 CoreFoundation 0x01aac10b __CFRunLoopDoSources0 + 235
23 CoreFoundation 0x01ac91ae __CFRunLoopRun + 910
24 CoreFoundation 0x01ac89d3 CFRunLoopRunSpecific + 467
25 CoreFoundation 0x01ac87eb CFRunLoopRunInMode + 123
26 GraphicsServices 0x032df5ee GSEventRunModal + 192
27 GraphicsServices 0x032df42b GSEventRun + 104
28 UIKit 0x004e0f9b UIApplicationMain + 1225
29 myMap 0x0001c37c main + 92
30 libdyld.dylib 0x020e4701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
It is quite late with this Answer, but for those looking for a solution: Try to create a storong property to hold this popover, and then when taping on the map accessory use the self.popover reference to init it with a content.
I have am using Xcode storyboards and have a View Controller that has a UITableView which in turn has a custom UITableViewCell.
The UITableViewCell has a UISwitch in it and I want to know when the value has changed. I have a IBAction that successfully fires when the value is changed
- (IBAction)updateSwitchAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(#"In SettingsViewcontroller updateSwitchAtIndexPath row=|%d \n", indexPath.row);
}
However when it fires the app terminates
2014-07-10 23:38:10.037 reactor[2572:60b] -[UISwitch row]: unrecognized selector sent to instance 0x944b7e0
2014-07-10 23:38:10.072 reactor[2572:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UISwitch row]: unrecognized selector sent to instance 0x944b7e0'
*** First throw call stack:
(
0 CoreFoundation 0x01a281e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x015758e5 objc_exception_throw + 44
2 CoreFoundation 0x01ac5243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x01a1850b ___forwarding___ + 1019
4 CoreFoundation 0x01a180ee _CF_forwarding_prep_0 + 14
5 positivity 0x00003807 -[SettingsViewController updateSwitchAtIndexPath:] + 87
6 libobjc.A.dylib 0x0158782b -[NSObject performSelector:withObject:] + 70
7 UIKit 0x002373b9 -[UIApplication sendAction:to:from:forEvent:] + 108
8 UIKit 0x00237345 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
9 UIKit 0x00338bd1 -[UIControl sendAction:to:forEvent:] + 66
10 UIKit 0x00338fc6 -[UIControl _sendActionsForEvents:withEvent:] + 577
11 UIKit 0x004c97a5 __31-[UISwitch _handleLongPressNL:]_block_invoke + 85
12 UIKit 0x004c8666 -[_UISwitchInternalViewNeueStyle1 _setPressed:on:animated:shouldAnimateLabels:completion:] + 243
13 UIKit 0x004c9681 -[UISwitch _handleLongPressNL:] + 286
14 UIKit 0x005d14f4 _UIGestureRecognizerSendActions + 230
15 UIKit 0x005d0168 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 383
16 UIKit 0x005d1bdd -[UIGestureRecognizer _delayedUpdateGesture] + 60
17 UIKit 0x005d513d ___UIGestureRecognizerUpdate_block_invoke + 57
18 UIKit 0x005d50be _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 317
19 UIKit 0x005cb7ac _UIGestureRecognizerUpdate + 199
20 UIKit 0x00276a5a -[UIWindow _sendGesturesForEvent:] + 1291
21 UIKit 0x00277971 -[UIWindow sendEvent:] + 1021
22 UIKit 0x002495f2 -[UIApplication sendEvent:] + 242
23 UIKit 0x00233353 _UIApplicationHandleEventQueue + 11455
24 CoreFoundation 0x019b177f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
25 CoreFoundation 0x019b110b __CFRunLoopDoSources0 + 235
26 CoreFoundation 0x019ce1ae __CFRunLoopRun + 910
27 CoreFoundation 0x019cd9d3 CFRunLoopRunSpecific + 467
28 CoreFoundation 0x019cd7eb CFRunLoopRunInMode + 123
29 GraphicsServices 0x03a1c5ee GSEventRunModal + 192
30 GraphicsServices 0x03a1c42b GSEventRun + 104
31 UIKit 0x00235f9b UIApplicationMain + 1225
32 positivity 0x00005dbd main + 141
33 libdyld.dylib 0x0206f701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Any help would be greatly appreciated
UISwitch does not have a property called "row." The way your IBOutlet is set up, you will actually get an UISwitch object as a parameter instead of NSIndexPath.
The better thing to do here is to use the delegate pattern. That way, the custom cell can notify the UIViewController (containing the UITableView) that the switch has been pressed.
So it would be more like:
- (IBAction)updateSwitchAtIndexPath:(UISwitch *)mySwitch
{
// notify the delegate about the switch update
if ([self.delegate respondsToSelector:#selector(switchWasPressed:)]) {
[self.delegate switchWasPressed:mySwitch];
}
}