Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SwiftMessages auto hidden #30

Closed
chakery opened this issue Oct 26, 2016 · 15 comments
Closed

SwiftMessages auto hidden #30

chakery opened this issue Oct 26, 2016 · 15 comments

Comments

@chakery
Copy link

chakery commented Oct 26, 2016

swift2.3 and Xcode8
hidden all the animation, when the SwiftMessages auto hidden.

@chakery chakery changed the title hidden SwiftMessages auto hidden Oct 26, 2016
@wtmoose
Copy link
Member

wtmoose commented Oct 26, 2016

I don't understand your question. Could you add some details please?

@chakery
Copy link
Author

chakery commented Oct 27, 2016

I have a UIAlertController and SwiftMessage in ViewController, both are show.
UIAlertController is hidden when the SwiftMessage is automatically hidden.

not only the UIAlertController, more that animation will are hidden.

@wtmoose
Copy link
Member

wtmoose commented Oct 27, 2016

Depending on how things are configured, the message view may be displayed in its own window (an instance of PassthroughWindow. This is a temporary window that gets removed after the message view is hidden. If the alert view is being presented in that window, then it would get removed as well.

Do you have a sample project reproducing the problem that you can attach here?

@chakery
Copy link
Author

chakery commented Oct 27, 2016

I tried to used default presentationContext, but SwiftMessage does't show sometimes.

when I multiple switching viewcontroller, SwiftMessage don't work.

import UIKit
import SwiftMessages

class MessageHelper {

    class func showSuccess(title title: String = "Success", body: String, layout: MessageView.Layout = MessageView.Layout.CardView) {
        let view = initView(layout, theme: Theme.Success, title: title, body: body)
        SwiftMessages.show(view: view)
    }

    class func showError(title title: String = "Error", body: String, layout: MessageView.Layout = MessageView.Layout.CardView) {
        let view = initView(layout, theme: Theme.Error, title: title, body: body)
        SwiftMessages.show(view: view)
    }

    class func showWarning(title title: String = "Warning", body: String, layout: MessageView.Layout = MessageView.Layout.CardView) {
        let view = initView(layout, theme: Theme.Warning, title: title, body: body)
        SwiftMessages.show(view: view)
    }

    class func showInfo(title title: String = "Info", body: String, layout: MessageView.Layout = MessageView.Layout.CardView) {
        let view = initView(layout, theme: Theme.Info, title: title, body: body)
        SwiftMessages.show(view: view)
    }

    private class func initView(layout: MessageView.Layout,
                                theme: Theme,
                                title: String,
                                body: String,
                                presentationStyle: SwiftMessages.PresentationStyle = .Bottom,
                                presentationContext: SwiftMessages.PresentationContext = .Window(windowLevel: UIWindowLevelAlert)) -> MessageView {
        SwiftMessages.defaultConfig.presentationContext = presentationContext
        SwiftMessages.defaultConfig.presentationStyle = presentationStyle
        let view = MessageView.viewFromNib(layout: layout)
        view.configureTheme(theme)
        view.configureDropShadow()
        view.button?.hidden = true
        view.configureContent(title: title, body: body)
        return view
    }
}

@wtmoose
Copy link
Member

wtmoose commented Oct 27, 2016

You're using a default window level UIWindowLevelAlert and it sounds like this conflicts with UIAlertController. Can you use UIWindowLevelNormal or UIWindowLevelStatusBar instead?

UIWindowLevelNormal to display the message under alerts. Use UIWindowLevelStatusBar to display the message over alerts (and the status bar). Either of these options should display the message over the main window.

@chakery
Copy link
Author

chakery commented Oct 27, 2016

thx, I'll try it. give your reply tomorrow.

@chakery
Copy link
Author

chakery commented Oct 28, 2016

I tried UIWindowLevelNormal and UIWindowLevelStatusBar, but problems persist.

@wtmoose
Copy link
Member

wtmoose commented Oct 28, 2016

I have not been able to reproduce your issue. In my tests, I have no problem displaying UIAlertController at the same time as a message. In order to help you further, I'll need more information. Ideally, supply me with a sample project that demonstrates the problem. I've attached my sample project that works if that helps. Also, I recommend posting this question to StackOverflow (and tagging @timothymoose). You'll get more eyes on the problem.

SwiftMessagesDebug.zip

@chakery
Copy link
Author

chakery commented Nov 3, 2016

alright, maby it is my problem, because the AlertController is custom by myself.

@chakery
Copy link
Author

chakery commented Nov 3, 2016

I got new problem made application crash, following log.

Could not instantiate class named UIStackView
(null)
((
    0   CoreFoundation                      0x00000001856ce5b8 <redacted> + 160
    1   libobjc.A.dylib                     0x0000000195e180e4 objc_exception_throw + 60
    2   CoreFoundation                      0x00000001856ce4dc <redacted> + 0
    3   UIKit                               0x000000018a3613cc <redacted> + 380
    4   UIKit                               0x000000018a36151c <redacted> + 716
    5   UIKit                               0x000000018a361238 <redacted> + 344
    6   UIKit                               0x000000018a13db50 <redacted> + 636
    7   UIKit                               0x000000018a36157c <redacted> + 812
    8   UIKit                               0x000000018a36151c <redacted> + 716
    9   UIKit                               0x000000018a361238 <redacted> + 344
    10  UIKit                               0x000000018a13db50 <redacted> + 636
    11  SwiftMessages                       0x0000000101ee559c _TTSf4g_n___TFC13SwiftMessages8BaseViewcfT5coderCSo7NSCoder_GSqS0__ + 180
    12  SwiftMessages                       0x0000000101ee3984 _TFC13SwiftMessages8BaseViewcfT5coderCSo7NSCoder_GSqS0__ + 20
    13  SwiftMessages                       0x0000000101ee7854 _TToFC13SwiftMessages11MessageViewcfT5coderCSo7NSCoder_GSqS0__ + 40
    14  UIKit                               0x000000018a288e98 <redacted> + 236
    15  UIKit                               0x000000018a36157c <redacted> + 812
    16  UIKit                               0x000000018a361238 <redacted> + 344
    17  UIKit                               0x000000018a2889a0 <redacted> + 128
    18  UIKit                               0x000000018a36157c <redacted> + 812
    19  UIKit                               0x000000018a36151c <redacted> + 716
    20  UIKit                               0x000000018a361238 <redacted> + 344
    21  UIKit                               0x000000018a287e28 <redacted> + 1100
    22  UIKit                               0x000000018a289e28 <redacted> + 188
    23  SwiftMessages                       0x0000000101ef5334 _TZFC13SwiftMessages13SwiftMessagesP33_AB28F0CA9BFF0B16E059C4C20EF9AFAA19internalViewFromNibuRxCSo6UIViewrfzT5namedSS6bundleGSqCSo8NSBundle_10filesOwnerPs9AnyObject__x + 416
    24  SwiftMessages                       0x0000000101ee7ca0 _TZFC13SwiftMessages11MessageView11viewFromNibuRxS0_rfT6layoutOS0_6Layout10filesOwnerPs9AnyObject__x + 120
    25  TalkpalLive                         0x10009db68 TalkpalLive + 645992
    26  TalkpalLive                         0x1000f43fc TalkpalLive + 1000444
    27  TalkpalLive                         0x10006d384 TalkpalLive + 447364
    28  TalkpalLive                         0x1000f4288 TalkpalLive + 1000072
    29  RxSwift                             0x00000001019ae998 _TFFE7RxSwiftPS_14ObservableType13subscribeNextFFwx1ET_PS_10Disposable_U_FGOS_5EventQQPS0_1E_T_ + 156
    30  RxSwift                             0x00000001019b5e10 _TFC7RxSwift12ObserverBase2onfGOS_5Eventx_T_ + 456
    31  RxSwift                             0x00000001019b5ed4 _TTWurGC7RxSwift12ObserverBasex_S_12ObserverTypeS_FS1_2onfGOS_5Eventwx1E_T_ + 52
    32  RxSwift                             0x00000001019dafa0 _TFC7RxSwift15SubscribeOnSink2onfGOS_5Eventwx1E_T_ + 232
    33  RxSwift                             0x00000001019db510 _TTWu0_Rx7RxSwift14ObservableType_S_12ObserverTypewx1Ezw_1ErGCS_15SubscribeOnSinkxq__S1_S_FS1_2onfGOS_5EventwxS3__T_ + 52
    34  RxSwift                             0x00000001019e25b8 _TFC7RxSwift13TakeUntilSink16_synchronized_onfGOS_5Eventx_T_ + 296
    35  RxSwift                             0x00000001019e28dc _TTWu1_R0_7RxSwift12ObserverTypexzw0_1ErGCS_13TakeUntilSinkxq_q0__S_18SynchronizedOnTypeS_FS3_16_synchronized_onfGOS_5EventwxS1__T_ + 52
    36  RxSwift                             0x00000001019de484 _TFE7RxSwiftPS_18SynchronizedOnType14synchronizedOnfGOS_5Eventwx1E_T_ + 80
    37  RxSwift                             0x00000001019e2928 _TTWu1_R0_7RxSwift12ObserverTypexzw0_1ErGCS_13TakeUntilSinkxq_q0__S0_S_FS0_2onfGOS_5EventwxS1__T_ + 52
    38  RxSwift                             0x000000010195ff78 _TFC7RxSwift23AnonymousObservableSink2onfGOS_5Eventwx1E_T_ + 636
    39  RxSwift                             0x00000001019600cc _TTWuRx7RxSwift12ObserverTyperGCS_23AnonymousObservableSinkx_S0_S_FS0_2onfGOS_5Eventwx1E_T_ + 52
    40  RxSwift                             0x0000000101960c88 _TPA + 72
    41  RxCocoa                             0x00000001018553ec _TPA__TFFFE7RxCocoaCSo9UIControl15rx_controlEventFVSC15UIControlEventsGVS_12ControlEventT__U_FGV7RxSwift11AnyObserverT__PS3_10Disposable_U_FS0_T_ + 84
    42  RxCocoa                             0x0000000101825e80 _TToFC7RxCocoa13ControlTarget12eventHandlerfGSQCSo9UIControl_T_ + 216
    43  UIKit                               0x0000000189eb1418 <redacted> + 96
    44  UIKit                               0x0000000189e9a52c <redacted> + 612
    45  UIKit                               0x0000000189eb0db4 <redacted> + 592
    46  UIKit                               0x0000000189eb0a40 <redacted> + 700
    47  UIKit                               0x0000000189ea9f94 <redacted> + 684
    48  UIKit                               0x0000000189e7d68c <redacted> + 264
    49  UIKit                               0x000000018a11c60c <redacted> + 14992
    50  UIKit                               0x0000000189e7bbf4 <redacted> + 1616
    51  CoreFoundation                      0x00000001856869ec <redacted> + 24
    52  CoreFoundation                      0x0000000185685c90 <redacted> + 264
    53  CoreFoundation                      0x0000000185683d40 <redacted> + 712
    54  CoreFoundation                      0x00000001855b10a4 CFRunLoopRunSpecific + 396
    55  GraphicsServices                    0x000000018e74b5a4 GSEventRunModal + 168
    56  UIKit                               0x0000000189ee2aa4 UIApplicationMain + 1488
    57  TalkpalLive                         0x100089990 TalkpalLive + 563600
    58  libdyld.dylib                       0x0000000196486a08 <redacted> + 4
)

@wtmoose
Copy link
Member

wtmoose commented Nov 3, 2016

Is this iOS 8? The layouts that use stack views aren't compatible with iOS 8. There is one layout provided for iOS 8 called MessageViewIOS8. You can copy the nib it into your project and modify it to suit your design. Or just create your own nib file.

@chakery
Copy link
Author

chakery commented Nov 4, 2016

ok, thx~

@chakery chakery closed this as completed Nov 4, 2016
@chakery
Copy link
Author

chakery commented Nov 4, 2016

StatusLine is also support iOS8.0, right?

@chakery chakery reopened this Nov 4, 2016
@wtmoose
Copy link
Member

wtmoose commented Nov 4, 2016

Yes, it does.

@chakery
Copy link
Author

chakery commented Nov 4, 2016

many thanks for your answer and the SwiftMessages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants