I have two applications named with,
- SendDataApp
- ReceiveDataApp
This is my StoryBoard of ReceiveDataApp
I can able to send data to my receiving app and can handle it by below method,
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options;
But, here the problem is i want to show the data which i received from SendDataApp to my DetailViewController
of ReceivedDataApp I am trying with below method to handle it,
Appdelegate.m
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options {
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
ViewController *viewController = (ViewController *)[storyBoard instantiateViewControllerWithIdentifier:@"View"];
[viewController receivedURL:url];
return YES;
}
ViewController.m
- (void)receivedURL:(NSURL *)url {
[self performSegueWithIdentifier:@"detailIdentifier" sender:url];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:@"detailIdentifier"]) {
DetailViewController *detail = [segue destinationViewController];
detail.receivingURL = (NSURL *)sender;
}
}
But, its giving me some error
Terminating app due to uncaught exception 'NSGenericException', reason: 'Could not find a navigation controller for segue 'detailIdentifier'. Push segues can only be used when the source controller is managed by an instance of UINavigationController.
My two viewcontrollers embedded in UINavigationController
only. And, normally i can view detail page by button action. But, not by URL Scheme
What was the mistake here? And, am i doing anything wrong here?
Give me some suggestions or idea to handle this.