如何从推送通知中推送VC ?

时间:2021-08-24 16:27:15

I receive a push which has an id of an object I need to look up. I save this to the app delegate.

我收到一个push,它有一个我需要查找的对象的id。我把它保存到app委托。

In my main view controller, I fetch an index of all the objects.

在主视图控制器中,我获取所有对象的索引。

I check if my app delegate has an id saved. If it does, I scan the objects I fetched from the index and push a detail view controller with that object.

我检查我的app委托是否保存了一个id。如果是这样,我就扫描从索引中获取的对象,并使用该对象推送一个详细的视图控制器。

The new view controller doesn't function properly and crashes when I tap back. Research indicated this is because my VC had a nil frame.

新的视图控制器功能不正常,当我返回时崩溃。研究表明这是因为我的VC有一个空帧。

What's a good workflow for pushing a detail VC from a push?

从推送中推送一个细节VC的好工作流程是什么?

1 个解决方案

#1


0  

With the information you have provided seems to be there is something wrong with your design.

你提供的信息似乎是你的设计出了问题。

Normally your user has a flow in navigation controller (1-2-3-4-5) and reaches to a point. What you might be trying to do is (1-5) and when the user comes back it crashes because it haven't been able to create that state back. If this is the case there is something wrong with your design.

通常您的用户在导航控制器(1-2-3-4-5)中有一个流,并到达一个点。你可能要做的是(1-5),当用户返回时,它会崩溃,因为它还不能创建那个状态。如果是这样的话,你的设计出了问题。

You can't push 5th element directly to a stack (a nav controller is a stack) without pushing first four. Reuse the code, trace the path normally user follows to create that state back.

你不能把第5个元素直接推到一个堆栈(一个nav控制器是一个堆栈),而不推前4。重用代码,跟踪通常用户遵循的路径以创建该状态。

#1


0  

With the information you have provided seems to be there is something wrong with your design.

你提供的信息似乎是你的设计出了问题。

Normally your user has a flow in navigation controller (1-2-3-4-5) and reaches to a point. What you might be trying to do is (1-5) and when the user comes back it crashes because it haven't been able to create that state back. If this is the case there is something wrong with your design.

通常您的用户在导航控制器(1-2-3-4-5)中有一个流,并到达一个点。你可能要做的是(1-5),当用户返回时,它会崩溃,因为它还不能创建那个状态。如果是这样的话,你的设计出了问题。

You can't push 5th element directly to a stack (a nav controller is a stack) without pushing first four. Reuse the code, trace the path normally user follows to create that state back.

你不能把第5个元素直接推到一个堆栈(一个nav控制器是一个堆栈),而不推前4。重用代码,跟踪通常用户遵循的路径以创建该状态。