Comments (7)
-1 is not a valid button index, so it makes sense for the alert to crash at that point. I believe UIAlertView
will also crash when you call buttonTitleAtIndex
with an invalid button index. If not, let me know what it does and I'll investigate.
The constraint issue is one that happens when building for iOS 8, but I haven't seen it on iOS 7. Can you confirm you're not building for iOS 8?
from sdcalertview.
Hi @scott90 , UIAlertView will not crash in this case. I use it this way because I just want to close the alert view without triggering any actions of it.
I'm on iOS 7.1.1. Thanks!
from sdcalertview.
Gotcha, I will look at it.
The fact that you're on iOS 7.1.1 doesn't mean that you built for that. Do you use Xcode 5 or Xcode 6 (beta)?
from sdcalertview.
I'm using Xcode 5.1.1 + iOS SDK 7.1.
Here's what I see:
Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x8f75440 V:[UILabel:0xa12a050]-(0)-| (Names: '|':UIScrollView:0xa12f360 )>",
"<NSLayoutConstraint:0x8c77dd0 V:[UILabel:0xa12a050]-(4)-[UILabel:0xa13b740]>",
"<NSLayoutConstraint:0x8c77e00 V:[UILabel:0xa13b740]-(0)-| (Names: '|':UIScrollView:0xa12f360 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x8c77dd0 V:[UILabel:0xa12a050]-(4)-[UILabel:0xa13b740]>
Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
from sdcalertview.
Ok, that shouldn't be happening then. I'll take a look at it.
from sdcalertview.
I'm going to mark both issues as a "won't fix".
The crash you mentioned happens on buttonTitleWithIndex:
, not dismissWithClickedButtonIndex:
. UIAlertView
also crashes when sending a non-existing buttonIndex to buttonTitleWithIndex:
, so the behavior is the same. I can't say crashing is the most elegant way of handling it (returning nil
would be better in my opinion), but that's how UIAlertView
works, so I want to match that behavior.
The auto-layout warning is a legitimate issue, but calling show
on an alert that you dismiss on the previous line is a very rare use case. In 99% of the situations, there's a better way of handling that. Unless you can tell me why you need to do it in exactly this way, I think spending time on other features, bug fixes, or iOS 8 compatibility is more productive.
I'm closing this issue, but if you want to further discuss, feel free to reopen or create a new issue.
As always, thanks for your input!
from sdcalertview.
I forgot to mention that in your example, changing the message
also causes the alert to crash. See #38 for the underlying cause. That is something that will definitely (have to) be fixed.
from sdcalertview.
Related Issues (20)
- Convert to Swift 5 HOT 1
- SPM support HOT 7
- [Question] Exclude view from being dimmed HOT 1
- Error with Catalyst HOT 2
- AttributedTitle of AlertAction does not apply (Color, font, etc...) with ActionSheet
- Example app crash on iPad presenting UIAlertController
- Readme.md images cannot be loaded
- Evaluate support to popover ActionSheet on iPad HOT 3
- ActionSheet custom view vertical alignment
- Open components to inheritance outside SDCAlertView module HOT 4
- Rounded corners are circles instead of squircles
- Different look for dark theme in ios 13 and ios 12 HOT 6
- AlertController with preferredStyle of .actionSheet Does Not Correctly Display attributedTitle or attributedMessage
- Crash on iOS 15 HOT 2
- How to perform height animation on contentView correctly? HOT 1
- Warning when showing AlertView with textfield
- override var supportedInterfaceOrientations: UIInterfaceOrientationMask HOT 1
- Crash on tintColorDidChange HOT 1
- Privacy manifest required by Apple HOT 1
- Privacy Manifest HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdcalertview.