Git Product home page Git Product logo

Comments (7)

sberrevoets avatar sberrevoets commented on May 25, 2024

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

porter-liu avatar porter-liu commented on May 25, 2024

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.

sberrevoets avatar sberrevoets commented on May 25, 2024

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.

porter-liu avatar porter-liu commented on May 25, 2024

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.

sberrevoets avatar sberrevoets commented on May 25, 2024

Ok, that shouldn't be happening then. I'll take a look at it.

from sdcalertview.

sberrevoets avatar sberrevoets commented on May 25, 2024

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.

sberrevoets avatar sberrevoets commented on May 25, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.