cruffenach / CRToast

A modern iOS toast view that can fit your notification needs
MIT License
4.16k stars 464 forks source link

toast notification is showing after kCRToastTimeIntervalKey, and the [CRToastManager isShowingNotification] returns NO #152

Open ijinmao opened 9 years ago

ijinmao commented 9 years ago

I came across this instance:

The toast notification is still showing after kCRToastTimeIntervalKey.

And [CRToastManager isShowingNotification] returns NO, but statusBar is covered by toast View.

Ashton-W commented 9 years ago

Thanks for the report!

Could you include which Xcode and iOS version you are using? Also if this happens on device only or in the simulator too.

ijinmao commented 9 years ago

Thanks for the reply~

Xcode version: 6.3 iOS version: 8.0 Test on iPhone 5c and iPad air

My app running process is:

When a user deletes his/her photo, app request to server, CRToast is showing "Deleting..." on statusBar before server responses(I set kCRToastTimeIntervalKey to DBL_MAX).

When request responses, app calls [CRToastManager dismissNotification:YES] in the response completion block, and then(next line of codes) app calls CRToast to show "deleted"(set kCRToastTimeIntervalKey to one sec).

But sometimes CRToastView is still showing "Deleting..." after server response.

dmiedema commented 9 years ago

Which version of CRToast are you using by chance?

ijinmao commented 9 years ago

I copied the CRToast directory of master branch to my project.

mamnun commented 9 years ago

@ijinmao are you sure you are calling the dismiss method on main thread? if your response completion block is in the background thread, any update ui is uncertain. may be you can try wrapping the call in a dispathc_async block?

dispatch_async(dispatch_get_main_queue(), ^{
    [CRToastManager dismissNotification:YES];
}];