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];
}
@end
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 on 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.
↧