OdinLink
一键唤醒 APP,跳转到指定界面
CocoaPods
CocoaPods 是向项目添加 OdinLink 的推荐方法。
- 将 OdinAnalysis 的 pod 条目添加到您的 Podfile 文件中
集成
pod 'OdinLink'
-
通过运行“pod Install”安装
-
在 AppDelegate 中导入头文件:
#import <OdinLinkSDK/ODLink.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[ODLink initWitOdinKey:@"1442AABEB4E2477892982BBC9D09BD61"];
return YES;
}
4.在需要恢复的控制器中实现 UIViewController+ODLSDKRestore 的两个方法
@interface ResotreAViewController ()
@property(nonatomic,strong)ODLSDKScene *scene;
@end
+ (NSString *)ODLSDKPath{
return @"/demo/a";
}
- (instancetype)initWithOdinLinkScene:(ODLSDKScene *)scene{
if (self = [super init])
{
self.scene = scene;
}
return self;
}
第一个是实现标识控制器路径的方法,第二个是实现带有场景参数的初始化方法,并根据场景参数还原该控制器
5.如果需要监听场景还原可以遵守:ODLSDKRestoreDelegate 代理并实现对应的代理方法
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[ODLink initWitOdinKey:@"1442AABEB4E2477892982BBC9D09BD61"];
[ODLink setDelegate:self];
return YES;
}
- (void)ODLSDKWillRestoreScene:(ODLSDKScene *)scene Restore:(void (^)(BOOL, RestoreStyle))restoreHandler{
restoreHandler(YES,ODLLPush);
}
- (void)ODLSDKCompleteRestore:(ODLSDKScene *)scene{
NSLog(@"完成场景还原");
}
- (void)ODLSDKNotFoundScene:(ODLSDKScene *)scene{
NSLog(@"未发现还原");
}