Custom Segue - unrecognized selector sent to instance - setUseDefaultModalPresentationStyle - ios

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.

Related

app crashes on isHidden property

I just converted the code from objective-c to swift and now there are some unknown crashes occurring in my app.
The app crashes on every outlet property whose visibility I change using selectedView.isHidden = false. The error is [Controller _mutableLayoutArrangements]: unrecognized selector sent to instance
When I commented out isHidden then viewDidLoad method a crash occur by saying [Controller _hostsLayoutEngine]: unrecognized selector sent to instance
I did some research but didn't find an exact reason for this behaviour. But I have some idea that these crashes are due to autolayout constraint crashes. But I'm not sure of this.
I found a line related to crash but I'm not able to solve the issue
layoutSublayersOfLayer:
check your storyboard views they have outlets which are not there in your UIViewController. You need to delete such outlets and retry running the project.
The solution to this problem i find is not usual, I checked that these issues I was facing "mutableLayoutArrangements and hostsLayoutEngine" are part of AGSLayer.
Then i checked and found i was importing the AGSLayer delegate. Removing the delegate solved my issue.
Actually previously I was using this for arcGis library.

Xcode 8.2 simulator showing white screen and giving SIGABRT error

I'm new to app development and I'm learning as I go. I started a new project and set the image background via image view and a png. Before preceding with anything else, I wanted to make sure that at least my background would show in the simulator.
When I run the simulator it shows a white background for a few seconds then Xcode pops up in AppDelegate with a
[4904:767382] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Storyboard () doesn't contain a view controller with identifier 'DataViewController''
First throw call stack:
`
Can anyone explain what the problem maybe?
Try to add the Storybaord ID ( DataViewController ) to your view controller in storybaord
a line like this may cause the crash
let vc = self.storyboard?.instantiateViewController(withIdentifier:"DataViewController")
self.navigationController?.pushViewController(vc!, animated: true)

iOS App crashes after migrating to swift3 during navigation

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...

iOS 8 | Add image to UIActionSheet's button

In iOS 7 and below , I added a custom image on UIActionSheet's buttons , but it seems it doesn't work on iOS 8 and crashes ! , here is the codes :
[[[sheet valueForKey:#"_buttons"] objectAtIndex:0] setImage:[UIImage imageNamed:#"image"] forState:UIControlStateNormal];
Crashes due to :
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIActionSheet 0x16d4abf0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key _buttons.'
*** First throw call stack:
It was always wrong to mess with the look / details of a UIActionSheet. The correct solution, both on iOS 7 and iOS 8, is to use a presented view controller whose view looks like an action sheet - but now it's your view and you can configure it however you like.
UIActionSheet is deprecated in iOS8, you may want to use the new UIAlertController with the UIAlertControllerStyleActionSheet style.
I agree with matt, you should not use dirty ways to custom an UIActionSheet, the safest and nicest way to have an UIActionSheet looks like you want to is to create yours.

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?

Resources