在详细控制器中打开通知

时间:2017-06-26 09:46:51

标签: ios swift firebase push-notification notifications

我在我的项目中使用FireBase,我收到主题通知。当点击通知打开并将数据传递给详细控制器时。

例如在BBC新闻节目中

是故事板

enter image description here

public class GoalItem : EntityData
{
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int Id { get; set; }

    public string Title { get; set; }

    public string Description { get; set; }

    public DateTime DueDate { get; set; }

    public bool Complete { get; set; }

    [ForeignKey("ParentGoal")]
    public int ParentGoalId { get; set; }

    [InverseProperty("SubGoals")]
    public GoalItem ParentGoal { get; set; }

    public List<GoalItem> SubGoals { get; set; }
}

2 个答案:

答案 0 :(得分:0)

Refer This

您需要重定向到您的特定详细视图控制器

答案 1 :(得分:0)

试试这个

在didFinishLaunchingWithOptions方法

中添加此代码
func getStoryboardObject(storyboardName:String) -> UIStoryboard {

    let storyboard = UIStoryboard(name: storyboardName as String, bundle: nil)

    return storyboard

}

在AppDelegate Class中添加此代码

获取StoryBoardObject

class func getDelegate() -> AppDelegate {
    return UIApplication.shared.delegate as! AppDelegate
} 

获取AppdelegateObject

{{1}}