智莺生活APP的阿里百川 Flutter 插件
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FlutterWxViewCtrlViewController.m 1.7 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // FlutterWxViewCtrlViewController.m
  3. // flutter_alibc
  4. //
  5. // Created by 吴兴 on 2019/10/22.
  6. //
  7. #import "FlutterWxViewCtrlViewController.h"
  8. @interface FlutterWxViewCtrlViewController ()
  9. @property(nonatomic,assign)int num;
  10. @end
  11. @implementation FlutterWxViewCtrlViewController
  12. - (instancetype)init
  13. {
  14. self = [super init];
  15. if (self) {
  16. self.num = 0;
  17. }
  18. return self;
  19. }
  20. - (void)viewDidLoad {
  21. [super viewDidLoad];
  22. self.view.backgroundColor = [UIColor whiteColor];
  23. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getAccessToken:) name:@"getAccessToken" object:nil];
  24. // 跳转到别的页面
  25. [self.navigationController pushViewController:self.vc animated:YES];
  26. // Do any additional setup after loading the view.
  27. }
  28. - (void)viewDidAppear:(BOOL)animated{
  29. self.num = self.num + 1;
  30. if (self.num == 2) {
  31. NSLog(@"该关闭了");
  32. [self.navigationController dismissViewControllerAnimated:YES completion:^{
  33. NSLog(@"执行dismiss回调");
  34. }];
  35. }
  36. }
  37. - (void)getAccessToken:(NSNotification *) notification {
  38. [[NSNotificationCenter defaultCenter] removeObserver:self];
  39. NSLog(@"写入accessToken");
  40. self.accessToken = notification.object;
  41. }
  42. - (void)dealloc{
  43. NSLog(@"dealloc执行");
  44. self.accessBlock(self.accessToken);
  45. }
  46. /*
  47. #pragma mark - Navigation
  48. // In a storyboard-based application, you will often want to do a little preparation before navigation
  49. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  50. // Get the new view controller using [segue destinationViewController].
  51. // Pass the selected object to the new view controller.
  52. }
  53. */
  54. @end