Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by siddharth3322 · Nov 20, 2014 at 04:24 PM · iosnative pluginsharingobjective-c

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

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image siddharth3322 · Nov 21, 2014 at 05:20 AM 0
Share

I really need some help.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by MotoLvv · Oct 16, 2015 at 10:16 AM

@siddharth3322 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:http://answers.unity3d.com/questions/32848/objectivec-how-to-show-a-custom-uiview-on-top-of-u.html

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

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

27 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Issue with integration into native iOS app 1 Answer

iOS native share PDF popup with QuickLook option 1 Answer

Using an Objective-c framework directly in Unity 3d 3 Answers

Executing native iOS code in Unity 1 Answer

Native Sharing dialog cause crash on iPad 2 iOS 7.1.2 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges