为什么我用 url 打开应用程序时没有显示任何内容?

Why its not showing anything when i open the app with url?

我有以下设置,当我在 iPhone 7 中使用 url 打开我的应用程序(应用程序编号 1 使用 url 打开应用程序编号 2)时,我没有得到任何 url 输入。

它根本没有显示任何警告框。 我如何检查我的应用程序是否收到了 url 输入?

AppDelegate.m:

#import "AppDelegate.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    return YES;
}

ViewController.m:

-(BOOL) application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
    //if (url != nil && [url isFileURL]) {
    //[self.ViewController handleOpenURL:url];
    //}
  id test = (NSURL *) url;
  UIAlertController * alert=   [UIAlertController
                                alertControllerWithTitle:@"My Title"
                                message:test
                                preferredStyle:UIAlertControllerStyleAlert];

  [self presentViewController:alert animated:YES completion:nil];
  //NSLog(@">>> got <<< >>> <<< !!!! >>>> : %@", url);
  return YES;
}

- (void)viewDidLoad {
  [super viewDidLoad];
}

问题是

-(BOOL) application:(UIApplication *)application 
    openURL:(NSURL *)url 
    sourceApplication:(NSString *)sourceApplication annotation:(id)annotation

... 是一个 UIApplicationDelegate 方法。所以它不能位于ViewController.m。它需要在 AppDelegate.m.