BulletinBoard icon indicating copy to clipboard operation
BulletinBoard copied to clipboard

Buttons on Bulletin do not work

Open docash59 opened this issue 7 years ago • 7 comments

Problem Description: The action buttons/handlers do not work.

Steps to reproduce:

  1. Install via Pods
  2. @import BLTNBoard
    BLTNPageItem *page = [[BLTNPageItem alloc] initWithTitle:@"Notifications"];
    page.descriptionText = @"Receieve latest news.";
    page.actionButtonTitle = @"Allow";
    page.alternativeButtonTitle = @"Decide later";
    
    page.actionHandler = ^(BLTNActionItem * _Nonnull _item) {
        [self requestNotifications];
    };
    
    BLTNPageItem *introPage = page;
    BLTNItemManager *man = [[BLTNItemManager alloc] initWithRootItem:introPage];
    
    [man showBulletinAboveViewController:self animated:YES completion:nil];
  1. Launch the app
  2. Tap Allow on the BulletinBoard
  3. Nothing happens. Tapping the ( X ) in the top right doesn't commit any action either.

Environment:

  • Device: iPhone X
  • OS: iOS 12.1.x / Xcode 10.1
  • Version of BulletinBoard: 3.0.0

docash59 avatar Jan 23 '19 11:01 docash59

This issue happens to me just sometimes, not yet sure why. I am using carthage btw.

soareseneves avatar Feb 11 '19 12:02 soareseneves

Same for me - tapping the ( X ) does nothing, same with the other buttons. It looks like the BLTNItemManager is nil at the moment the ( X ) is being pressed, and thus the view can't be dismissed.

AveryVine avatar Feb 12 '19 04:02 AveryVine

It is a common error for people who use the library: you need to retain the manager as a property, usually on the view controller that presents it.

alexaubry avatar Feb 12 '19 05:02 alexaubry

Another possibility... If you are overriding the setUp method, make sure you call super.setUp() or [super setUp]. This is where the action button gets wired up and if you forget to call the super method it doesn't work.

artisanglobal avatar Feb 17 '19 06:02 artisanglobal

Understood thank you. Have tried again and the BLTNBoard now works, thank you!

docash59 avatar Feb 21 '19 12:02 docash59

Can you expand on what you mean by "you need to retain the manager as a property, usually on the view controller that presents it."? Can you give some example code. I've tried doing the following on the presenting viewcontroller but that doesn't fix it. Not sure how else to do it? lazy var bulletinManager: BLTNItemManager = { let introPage = BulletinDataSource.makeIntroPage() let manager = introPage.manager return BLTNItemManager(rootItem: introPage) }()

rlindsey2 avatar Jul 04 '19 21:07 rlindsey2

Follow on from the above comment, this is the code of the root item: static func makeIntroPage() -> BLTNPageItem {

    let page = BLTNPageItem(title: "Boost your creativity and improve your writing ability")
    page.appearance.titleTextColor = UIColor(red: 34/256, green: 34/256, blue: 34/256, alpha: 1)
    page.appearance.titleFontSize = 25
    page.descriptionText = "Daily Prompt helps you get into the habit of creating beautiful works of art every day.\n\n\n\n"
    
    page.actionButtonTitle = "Continue"
    page.appearance.actionButtonColor = UIColor(red: 111/256, green: 101/256, blue: 215/256, alpha: 1)
    page.appearance.actionButtonFontSize = 22
    page.isDismissable = false
    
    page.actionHandler = { item in
        item.manager?.displayNextItem()
    }
    
    page.next = newPromptdaily()
    
    return page
}

rlindsey2 avatar Jul 04 '19 22:07 rlindsey2