TSMessages
TSMessages copied to clipboard
[TSMessage dismissActiveNotification] does not work
I'm currently facing an issue where a notification cannot be dismissed, because currentMessage.messageIsFullyDisplayed
is NO
here.
Situation is this: I display a message while some background job is done. After that the message is dismissed. For some reason this does not work in all cases for the reason mentioned above. It seems to be caused by the completion block not being called. I tried this in several ways: on the main thread, on a background thread, in a dispatch queue.
That's difficult to reproduce. Could you provide an example project?
am facing the same issue, on my case i have a navigation transition which fire a notification, then in another area of the app i fire the a new notification. only the first notification is shown...
Here is an example to illustrate how dismissActiveNotification
does not work:
- (void)saveToAlbum {
[TSMessage showNotificationWithTitle:NSLocalizedString(@"Saving...", nil)
subtitle:self.displayName
type:TSMessageNotificationTypeMessage];
ALAssetsLibrary* library = [[ALAssetsLibrary alloc] init];
[library writeVideoAtPathToSavedPhotosAlbum:[NSURL fileURLWithPath:self.name]
completionBlock:^(NSURL *assetURL, NSError *error)
{
[TSMessage dismissActiveNotification];
[TSMessage showNotificationWithTitle:NSLocalizedString(@"OK", nil)
subtitle:self.displayName
type:TSMessageNotificationTypeSuccess];
}];
}
The first TSMessageNotificationTypeMessage
last as long as it takes no matter how soon dismissActiveNotification
is called.
@horaceho - Is there potentially an issue of the completion block not running on Main? https://developer.apple.com/library/ios/documentation/AssetsLibrary/Reference/ALAssetsLibrary_Class/index.html
Same situation for me. I am calling dismiss before the fadeIn animation completes. Thus, messageIsFullyDisplayed == false.
if (currentMessage.messageIsFullyDisplayed) { [[TSMessage sharedMessage] fadeOutNotification:currentMessage animationFinishedBlock:completion]; }
Thus, the fadeOut never gets called if the fadeIn has not completed.