Sharing image and text using objective c native code

I am trying to share image and text on any selected social media. I want to implement functionality similar to intent sharing in android.

For this I have written following code in objective c and call same method in my unity c# code

@implementation ViewController
-(void) shareMethod: (const char *) path
    NSLog(@"Sample Method Execute");
    NSString *imagePath = [NSString stringWithUTF8String:path];
    //        UIImage *image      = [UIImage imageNamed:imagePath];
    NSString *message   = @"Best image from my application.";
    NSArray *postItems  = @[message];
    UIActivityViewController *activityVc = [[UIActivityViewController alloc]initWithActivityItems:postItems applicationActivities:nil];
    [self presentViewController:activityVc animated:YES completion:nil];
extern "C"{
    void sampleMethod(const char * path){
        ViewController *vc = [[ViewController alloc] init];
        [vc shareMethod: path];
        [vc release];

But using above code I am getting following warnings in xcode

2014-11-20 21:04:54.565 screenshotdemo[3731:a0b] Sample Method Execute
2014-11-20 21:04:54.566 screenshotdemo[3731:a0b] Warning: Attempt to present <UIActivityViewController: 0x16c56f90> on <ViewController: 0xc8e6db0> whose view is not in the window hierarchy!

Also I want to mention that all NSLog statement printed on screen. If I execute same code in core xcode project then it works perfectly but exporting same thing using Unity creates problem for me.

I am facing this problem from many days. Please I need some help to solve the problem.

You can try UIWindow *window = [[UIApplication sharedApplication] keyWindow];
[window addSubview: _instance.view];

It maybe appear.But my problem is (I want to use imagePicker) after the view appear I do things,then the view dismissed,but the Unity can’t response my Click action.It seems like something invisible is still being displayed on top. You can see here:ObjectiveC: How to show a custom UIView on top of Unity - Unity Answers

It’s 2015 and I really need to find a solution.