iOS App crashes after migrating to swift3 during navigation - ios

I have migrated my project to Swift3 and after conversion the app crashes whenever I click on any button which loads a new screen. The crash happens in the assembly code so am not able to figure out what's the issue. Control leaves the existing class then goes to assembly language and then crash just before loading the new screen.
This is the error message am getting
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_SwiftValue pointSize]: unrecognized selector sent to instance 0x61000005fb00'
Crash is not happening in any specific code so its difficult identify the error. Please help me to figure this out.

You maybe have a outlet from your storyboard (label, textfield, uiButton...) that is not map anymore in your controller. You should check each component to see if you didn't delete the reference in the controller and no in the storyboard...

Related

Why the same code goes with different result

I just pull the code of my team. But why it run well with the other simulator, and my device it always goes crash. I also use the xcode 7.2, which is the same as the other, and the code are similar, and run with the same simulator (Iphone6). But when I go to the abcViewController, it goes crash.
It says:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Storyboard (<UIStoryboard: 0x7fb5e2409200>) doesn't contain a view controller with identifier 'StepDetailViewController''
*** First throw call stack:
The problem is not the code, so I don't put it here. Anyone know why this happen?
The error message already includes what's wrong:
'Storyboard (<UIStoryboard: 0x7fb5e2409200>) doesn't contain a view controller with identifier 'StepDetailViewController'
Your storyboard file (probably Main.storyboard) has a UIViewController which doesn't have an identifier. Open the storyboard, click on the UIViewController and enter StepDetailViewController in the Storyboard ID textfield in the identity inspector on the right side of your XCode window.
You have to make sure of following things in Interface Builder:
In the Attribute inspector, make sure your project is selected in the
Module field
In the Identity section of the Attribute Inspector your
Storyboard ID should be 'StepDetailViewController'
If you are using Git, it might be a good idea to check the files are on the .gitignore file, if the above points don't help, your problem is probably in one of the added files.

Custom Segue - unrecognized selector sent to instance - setUseDefaultModalPresentationStyle

I'm using this custom segue. It works perfectly on iOS8+, however, on iOS 7, I get this error.
2015-10-09 13:59:02.891 APPNAME[1790:60b] -[APPNAME.AFBlurSegue setUseDefaultModalPresentationStyle:]: unrecognized selector sent to instance 0x15ddafe0
2015-10-09 13:59:02.901 APPNAME[1790:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[APPNAME.AFBlurSegue setUseDefaultModalPresentationStyle:]: unrecognized selector sent to instance 0x15ddafe0'
*** First throw call stack:
(0x2e5c6f83 0x38d77ccf 0x2e5ca917 0x2e5c9203 0x2e518768 0x312c0381 0x312b63fb 0x30e19037 0x30e18fd7 0x30e18fb1 0x30e04717 0x30e18a2f 0x30e18701 0x30e136cb 0x30de88cd 0x30de6f77 0x2e59220b 0x2e5916db 0x2e58fecf 0x2e4faebf 0x2e4faca3 0x33400663 0x30e4714d 0x13e65c 0x39284ab7)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
The problem is, the crash is vague. I even tried putting breakpoints everywhere and tried to catch any errors thrown. However, it still doesn't point to where the error could be.
The fact that it seems like an argument/selector error, I suspect this might be a Swift 2 error. The only place I can find a reference to setUseDefaultModalPresentationStyle is here.
Any help would be greatly appreciated!
Try set Segue setting to Custom on the segue in storyboard, and set the style programmatically:
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
UIViewController *destination = segue.destinationViewController;
destination.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
}
This happens because this library uses the UIVisualEffectView to get the blur effect. Unfortunately UIVisualEffectView is only available in iOS 8 and up.
See the documentation for more information.
Unfortunately, if you want to use your fancy blur transitions, your app wont be compatible with iOS 7 and below, which isn't that much of a problem, since currently only 10% devices have iOS below iOS 8.
More info here
Solution:
You could solve this using an older version of this library which does not yet use the UIVisualEffectView but instead uses UIImage+ImageEffects.m to get the blur effect.

Creating a slide menu with a split view controller

My app is a simple Master-Detail applciation, based on a Split View Controller (for the iPhone 6+). The Master View is listing the news of my Web Site, and the Detail View is showing the news, embedded in a UIWebView.
I'm trying to add a side menu (like ECSlidingViewController), but I can't find an API fully fonctionable with my app. Do you have any idea of an API compatible with StoryBoards and a Split View ?
Or maybe do you have an idea on how to make compatible ECSlidingViewController with a Split View ? I can't make it, I have a fatal error :
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ECSlidingViewController viewControllers]: unrecognized selector sent to instance 0x14ee133d0'
The Storyboard of my app.
Thanks in advance.

NSInvalidUnarchiveOperationException, UIStoryboardShowSegueTemplate

I am using storyboard in which there is UINavigationController. View controllers are popped and pushed.
The issue is , when i push a UIViewController i take the exception on iOS 7, it works fine on iOS 8.
Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named UIStoryboardShowSegueTemplate'
What can be the problem?
Could you please help
As i am also getting the same issue with my project. I get this resolved by rechecking all segues i defined in the app. Make sure all segues will have some action like push/pop/modal.
If not then on that controller app will crash. Please check below snapshot which you will find in your storyboard.
Refer a solution on below link.
"Could not instantiate class named UIStoryboardShowSegueTemplate" - how can I make a Storyboard happy with iOS 7 and iOS 8?

How do I identify where a "NSArrayM was mutated while being enumerated" is coming from

I sometimes get this error:
*** Terminating app due to uncaught exception 'NSGenericException', reason:
'*** Collection <__NSArrayM: 0x170057580> was mutated while being enumerated.'
I understand that I'm mutating an array while using fast enumeration, but I can't figure out how to identify where this issue is happening. The stack trace shows me absolutely nothing, and other than just randomly setting breakpoints and guessing until I find it, I can't figure out a good way to zero in on where this is happening.
Is there some kind of breakpoint magic I can do so the compiler shows me where this happens? Or can I use NSZombies to somehow identify this? Any help would be much appreciated.
See how to set an exception breakpoint:
https://developer.apple.com/library/ios/recipes/xcode_help-breakpoint_navigator/articles/adding_an_exception_breakpoint.html
But in the latest Xcode you only need to do these steps:
In the bottom-left corner of the breakpoints navigator, click the Add button.
Choose Add Exception Breakpoint.
You then get this in the breakpoint navigator
Your code will now break when the exception is thrown rather than when it is caught. You should be able to navigate the call stack to see where in your code the exception is occurring.

Resources