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

Buttons on Bulletin do not work #142

Open
docash59 opened this issue Jan 23, 2019 · 7 comments
Open

Buttons on Bulletin do not work #142

docash59 opened this issue Jan 23, 2019 · 7 comments

Comments

@docash59
Copy link

docash59 commented Jan 23, 2019

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
@soareseneves
Copy link

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

@AveryVine
Copy link

AveryVine commented Feb 12, 2019

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.

@alexisakers
Copy link
Owner

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.

@artisanglobal
Copy link

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.

@docash59
Copy link
Author

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

@rlindsey2
Copy link

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
Copy link

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
}

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

6 participants