Search Unity

[Released] IOS Native Unity3D Plugin

Discussion in 'Assets and Asset Store' started by stanislav-osipov, Apr 22, 2013.

  1. dpkonofa

    dpkonofa

    Joined:
    Nov 6, 2012
    Posts:
    16
    Hey, Stan/lacost!

    I'm not sure I have a memory leak since this only loads once and then I simply hide the ad when the next scene loads. I never display it again or create another banner. The banner creation code runs in the Start() of 1 scene and that's it.

    As for the Interstitial Ad, I'm fairly certain it's a plugin issue, but it could be a result of how I'm calling it. The way that it's setup is that I have a script for my Main Menu and then a script for my actual game. When someone exits the game to the Main Menu, I'm making the Menu script active and the game script inactive. Theoretically, this triggers the OnEnable() and OnDisable() methods when it switches from one or the other. All my other calls in OnDisable() work fine except for the Interstitial. It works the first time, but, if I close the Ad, I can re-enter the game, quit out to the main menu and have all the OnDisable() code run but I never see the Interstitial. If I quit out of the game and restart it, I see it again, but only the first time after restart. After that, nothing. I even added some Console.log() calls for debugging purposes and the ones in OnDisable() fire, but the ones in iAdBannerController only fire the first time.

    Thoughts?
     
  2. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Thanks a lot, I am steel waiting some info from Unity before I can make plugin Unity 5 ready. Point is that Unity alpha version is working a bit different with native plugin then current Unity beta. So I am a bit lost what to do, before I will get straight forward replay from unity team.


    And you never coming back to this scene? Because if you do Start() function will be called again and new banner object will be created.


    Is it possible to get your project with the small step by step guide how can I re-create the issue? It's the best way for me to work in issues like that.

    Cheers!
     
    dpkonofa likes this.
  3. dpkonofa

    dpkonofa

    Joined:
    Nov 6, 2012
    Posts:
    16
    That's correct. I only use that scene to load assets before the game starts. I don't want to be very intrusive with ads so I'm trying not to include them everywhere. Having it setup this way doesn't interrupt anything the player is doing. Since I don't have to load assets multiple times, this function only gets called once. That's the way I want it, though. I just want to make sure that, as long as I'm not creating more Ads or re-running that Start() function, there's not a memory leak.

    As for the second piece, I can absolutely send you a copy of the project. It might be rather large, though, so I'll email you to figure out the best way to get it over to you. Thanks!
     
  4. raghuramidi

    raghuramidi

    Joined:
    Jun 18, 2013
    Posts:
    3
    Please help, i have xcode, IOS Native plugin all latest version installed. I am getting "Undefined symbols for architecture armv7: " error. Please find attachment for more details about error
     

    Attached Files:

  5. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    I am already got PM from you, yea let me see your project it will give me all info I need to solve the issue.
    Cheers!
     
  6. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Are you using Unity 5?
     
  7. stfj

    stfj

    Joined:
    Jan 18, 2014
    Posts:
    15
    to everyone using unity 5 and getting linking/ARC errors:

    well. i have the plugin working for unity 5 if anyones using that. It's a bit of a hack since it modifies everything in your iOS plugins folder (so if you're using other plugins that use ARC you might want to edit my script). Also I have some custom code in there to fix adcolony as well (since im using that), but that code shouldn't prove a problem to anyone and can be safely ignored even if you're not using adcolony

    Just put the files in the directories in the assets folder that match in your unity project assets folder.
    Also make sure that your plugins/iOS folder is named that. I believe this asset imports as plugins/IOS which can be a problem. I'm not 100% sure this works on pc, but it works great on mac.

    enjoy!
     

    Attached Files:

    Mintah likes this.
  8. Muralidaran

    Muralidaran

    Joined:
    May 2, 2014
    Posts:
    93
    Hello,

    I was wondering if there is a video tutorial for setting up the IOS iaps. I saw the one for android but no ios. I am not a coder so the documentation is a little confusing. Not sure if I have to make my own script or if I can use the marketexample.cs but just change the product IDs to my own.

    Thanks
     
  9. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Hello, @stfj Thanks for pointing this, appreciated.

    No there is not video for IOS currently. If you will point what exactly is confusing in the documentation, I would be happy to explain it and update the doc.
    Cheers!
     
  10. iEpic

    iEpic

    Joined:
    Sep 29, 2013
    Posts:
    119
    If I buy this plugin, will I be able to use the iAd interstitials on iPhones?
    Prime31's iAd plugin claims full interstitial support for all iOS devices, but if your plugin can do the same thing, I will buy yours instead because of the playmaker support.
    Thanks and let me know!
     
  11. spotavi

    spotavi

    Joined:
    Aug 30, 2014
    Posts:
    31
    Is there any plan to support Turn Based matches ? Or is it already part of the plugin.

    Planning to buy the plugin , just want a Turn based solution for iOS
     
  12. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Not yet, put will be added shortly.


    Well officially Apple claims that interstitial available only for iPad. But it's working fine on iPhone as well. It only failes on iPod.
     
  13. stfj

    stfj

    Joined:
    Jan 18, 2014
    Posts:
    15
    hey stan
    I'm implementing your tweet/facebook social media stuff and im noticing a weird bug where if my unity application is locked to portrait, but i've rotated my ipad to landscape, the dialogue presents in landscape, and forcibly rotates my app to landscape even though my app only supports portrait orientation.

    I've been digging through docs trying to figure out how to turn off autorotate but nothing has worked properly yet. I'll keep digging but in the meantime do you have any ideas on how to do this? thanks so much!
     
  14. stfj

    stfj

    Joined:
    Jan 18, 2014
    Posts:
    15
    ok. found the solution in case someone else needs it some day.
    I added
    Code (CSharp):
    1. [[UIDevice currentDevice] setValue:
    2.      [NSNumber numberWithInteger: UIInterfaceOrientationPortrait]
    3.                                 forKey:@"orientation"];
    4.    
    5.     [SLComposeServiceViewController attemptRotationToDeviceOrientation];
    above the lines where SLComposeViewController is called wherever it's called in SocialGate.mm
     
  15. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Thanks @stfj for the report and for solution. I will definitely implement to the new IOS Native Version
     
  16. sebastiansgames

    sebastiansgames

    Joined:
    Mar 25, 2014
    Posts:
    114
    Can I please add a second request for this feature (SMS)? Being able to send a text message is pretty important. :) Thank you, Stan!
     
  17. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Sure.
    But what about recepient's what data you want to provide in this filed?
    I assume you will going to need adress book load as well?
     
  18. Tyhja

    Tyhja

    Joined:
    Jun 21, 2013
    Posts:
    19
    Hi Stan,
    I've been trying to use your iCloud plugin. It works fine for the first save. However it seems to not be able to override the file for subsequent saves.
    Also, it would be nice if there is a reply to know if the upload/save succeeded or failed, in which case the user might try to upload/save to iCloud again.
    Regards,

    Edit: I'm using setData(string,byte[]).
    Edit2 : "ISN_AcheivmentProgressResult" is also spelt incorrectly
     
    Last edited: Jan 27, 2015
  19. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
  20. Tyhja

    Tyhja

    Joined:
    Jun 21, 2013
    Posts:
    19
    Yes, I am familiar with the docs. I have also thoroughly went through (and tested) the iCloudUseExample.cs
    As far as I can see, the callback you are referring to is "OnCloundDataChangedAction", which even in your example class you put "IOSNativePopUpManager.showMessage("iCloud", "Cloud Data Was Changed On Other Device");" I would like to highlight "other" as the callback doesn't trigger on the same device, which is kind of what i was requesting.
    ie: i need a callback that says "Save successful from this device"

    Also I havent been able to save any subsequent files from the first save. Can you confirm or deny this?
    ie I have been saving setData(key,byte[]);
    then to override the file (new save) i have done setData(key,byte2[]).
    Just to be clear we are on the same page. I want to override my previous save with this. And it is not working.

    edit: clarification
     
    Last edited: Jan 27, 2015
  21. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    So you mean if if have saved some data once - it working. If you trying to save data using same key (override) data isn't saved and you have old data.
    If so it sounds like a bug, and I will test it and let you know.

    About actions. There is no point to notifay about current device data change, since there can be no reson for data to not be saved, and it saved imidiatly. That's why apple does not provide any notification about it.

    P.S. If you want to have a look on native implementation yourself its under the CloudManager.mm file.
     
  22. Tyhja

    Tyhja

    Joined:
    Jun 21, 2013
    Posts:
    19
    Exactly. Thank you.
    Yes, there is a reason, for example if the user has no connection to the internet (ie loses connection halfway) the user would have no feedback that his upload would have failed. (ie the "upload" would have processed as successful even if that is not the case.) There are also more edge cases that the user loses connection even while the file is halfway sent, or for some reason iCloud was down for him (for example apple api change, yes that might be infrequent, im just using an extreme example). ALL these cases would be definitely not "no reason" for data not to be saved as it would have failed.
     
  23. HuikuShih

    HuikuShih

    Joined:
    Nov 8, 2012
    Posts:
    11
    I have a little question about function FacebookPost. So far when I try to share a link (as string), the result didn't show the thumbnail on the facebook. How can I share a link with thumbnail?
     
  24. OnePxl

    OnePxl

    Joined:
    Aug 6, 2012
    Posts:
    307
    But the file should still be there locally in the iCloud container dir, errors in uploading affects syncing, not saving, right?
     
  25. Tyhja

    Tyhja

    Joined:
    Jun 21, 2013
    Posts:
    19
    Ok I didnt know the plugin saves it into the local iCloud Folder. If that's the case then that's fine then. Thanks.
     
  26. Tyhja

    Tyhja

    Joined:
    Jun 21, 2013
    Posts:
    19
    Hi Stan, any update?
     
  27. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    I will have a look but not sure that IOS SLComposeServiceViewController supporting this.

    Sorry for long replay, on it.
     
  28. Lab618

    Lab618

    Joined:
    Jan 12, 2015
    Posts:
    36
    Hi Stan,

    I've just updated Unity to version 4.6.2 (earlier than I wanted due to Apple's 64bit deadline) and now my project has loads of errors when I try to build in Xcode. Do you know if any of these are likely to be connected to iOS Native?

    Cheers
    Steve
     
  29. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Hi,

    in order to get them resolved you need to either:

    1) Post the actual errors you're getting so somebody could give you a workaround;
    2) Submit a bug so we could fix it.

    If you don't do anything and you're hitting some obscure case that nobody else is, chances are that you're gonna hit same issue again when you try it in 2 months. Waiting doesn't solve anything :).
     
  30. Lab618

    Lab618

    Joined:
    Jan 12, 2015
    Posts:
    36
  31. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Thanks. We'll look into it.
     
  32. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    Is it possible with your plug-in to get the original purchase date of the App using receipt validation?

    Note I'm looking for receipt info on the App itself, not on IAP.

    Usage scenario: If I flip my game from paid to free, I want to be able to differentiate between those who paid for the app and those who got the free version. I could do this if I had the purchase date (or version at time of purchase)

    It seem possible using this:

    https://developer.apple.com/library...y.html#//apple_ref/doc/uid/TP40010573-CH1-SW2

    but I would prefer a nice wrapper for grabbing the data I need. Was hoping your plug-in could provide this.

    -Jeff
     
  33. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Hey @Lab618, I will update my Unity version to 4.6.2 and will test it. I will solve (if issue on my side) ot report bugs unity in case I will found any issue in IOS Native with 64bit deploy.

    Hello @jeffweber I will ad this ot the features request list, and I am pretty sure it will be implemented to the new IOS Native version.

    Cheers!
     
  34. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    That would be great. Thanks!
     
  35. Lab618

    Lab618

    Joined:
    Jan 12, 2015
    Posts:
    36
    Thanks @lacost

    The errors disappeared after testing my project with Playmaker and iTween removed, so there's a good chance your code is fine. Might be worth testing though, just to be sure it's compatible, especially as everyone developing for iOS will have to upgrade to at least Unity 4.6.2 in order to create 64bit builds now.

    Thanks again for a great product Stan.
     
  36. Tyhja

    Tyhja

    Joined:
    Jun 21, 2013
    Posts:
    19
    Hi Stan,

    Can I get a confirmation for my report? Or is there something that I'm doing wrong. If you are working on the fix then its fine, I'd just like to know.
     
  37. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Glad to hear that @Lab618 .
    Hey @Tyhja I've sended you PM few days ago, I would like to talk with you on skype or make team viwer sessions, this will help me to solve the issue faster. Thanks.
     
  38. seanbro

    seanbro

    Joined:
    Apr 25, 2013
    Posts:
    13
    I added my own. It doesn't tell you what action the user took, but it does tell you when the native share dialog has been closed. This is useful for me because I pause the game to share and unpause when they are done. I'm sure you could add more detailed information if you tweak it a bit. Add the following code to each file:

    Extensions/IOSNative/Social/IOSSocialManager.cs (inside IOSSocialManager class)
    Code (csharp):
    1. public const string SHARE_MEDIA_DONE = "share_media_done";
    2.  
    3. private void OnShareMediaDone() {
    4.     dispatch(SHARE_MEDIA_DONE);
    5. }
    Plugins/iOS/SocialGate.mm (inside mediaShare function, at the very end)
    Code (csharp):
    1. controller.completionHandler = ^(NSString *activityType, BOOL completed) {
    2.     UnitySendMessage("IOSSocialManager", "OnShareMediaDone", [ISNDataConvertor NSStringToChar:@""]);
    3. };
    Then set a listener in your game script before you call ShareMedia:
    Code (csharp):
    1. IOSSocialManager.instance.addEventListener(IOSSocialManager.SHARE_MEDIA_DONE, myCallbackFunction);
    Stan, feel free to add this code to the plugin if you think it would be useful.
     
  39. ababab5

    ababab5

    Joined:
    Apr 15, 2014
    Posts:
    508
    Hi,

    Is it possible to create a Dialog Pop-up with more than 2 buttons ? (should be great for the in app : "buy", "restore", "cancel")
    (same question for Android Native)

    Thank you.

    Best regards,

    AB
     
  40. RC15

    RC15

    Joined:
    Apr 19, 2013
    Posts:
    38
    Hi Stan,

    is it possibile to get other players usernames in multigame and pearToaPear match ?
     
  41. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Hey @seanbro this is my bad, I confused native sharing on IOS with sharing on Android. we actually can get the share result. I added code snipped to this article:
    https://unionassets.com/iosnative/social-sharing-9

    Well currently no, but you can make a copy of IOSRateUsPopUp.cs and just override a bit onPopUpCallBack by exluding RedirectToAppStoreRatingPage method
    Code (CSharp):
    1. public void onPopUpCallBack(string buttonIndex) {
    2.         int index = System.Convert.ToInt16(buttonIndex);
    3.         switch(index) {
    4.             case 0:
    5.                 IOSNativeUtility.RedirectToAppStoreRatingPage(); //this one
    6.                 OnComplete(IOSDialogResult.RATED);
    7.                 dispatch(BaseEvent.COMPLETE, IOSDialogResult.RATED);
    8.                 break;
    9.             case 1:
    10.                 OnComplete(IOSDialogResult.REMIND);
    11.                 dispatch(BaseEvent.COMPLETE, IOSDialogResult.REMIND);
    12.                 break;
    13.             case 2:
    14.                 OnComplete(IOSDialogResult.DECLINED);
    15.                 dispatch(BaseEvent.COMPLETE, IOSDialogResult.DECLINED);
    16.                 break;
    17.         }
    18.        
    19.        
    20.        
    21.         Destroy(gameObject);
    22.     }
    Sure:
    Code (CSharp):
    1. GameCenterPlayerTemplate player = GameCenterManager.GetPlayerById("player_ide_here");
    2.         if (player != null) {
    3.             //code
    4.         }
    Do not foget check for null pointer, since player info can be loaded with the delay after player is connected.
    Cheers!
     
    ababab5 likes this.
  42. RC15

    RC15

    Joined:
    Apr 19, 2013
    Posts:
    38
    Thanks Stan :)

    Have you already tested the plugin with 64-bit unity 4.6.2 version ?!
    Does it work ?
     
  43. hakankaraduman

    hakankaraduman

    Joined:
    Aug 27, 2012
    Posts:
    354
    I tested, It works
     
  44. RC15

    RC15

    Joined:
    Apr 19, 2013
    Posts:
    38
    Cool thanks hakankaraduma
     
    hakankaraduman likes this.
  45. MagicFrame

    MagicFrame

    Joined:
    Jul 18, 2013
    Posts:
    42
    Hi Stan,

    I bought your plugin but I need a little help, I'm working on integrating local Notifications, as I can handle local notifications? For example, I shot a local notification to within 5 minutes when the notification has arrived back to the game and I want to cancel the local notification, to remove the badge. When I have to remove the notification? Obviously the function "Start" I can not, because maybe return to the game before the time of the local notification is met. I'm confused about how to handle local notifications .... And, As I can remove badges?
     
    Last edited: Feb 9, 2015
  46. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    The bages functinality is under developemnt curently.
    Wel actually you can, if this is for example your menu scene and by using static variable. little example:
    Code (CSharp):
    1. private static bool IsGameJustStarted = true;
    2. void Start() {
    3.     if(IsGameJustStarted) {
    4.         //do something on your app start
    5.        IsGameJustStarted = false
    6.     }
    7. }
     
  47. RC15

    RC15

    Joined:
    Apr 19, 2013
    Posts:
    38
    Hi Stan,

    is it possible to use multiplayer with my own gui ?!

    Thanks.
     
  48. rrrrhoi

    rrrrhoi

    Joined:
    Jun 4, 2014
    Posts:
    9
  49. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
  50. rrrrhoi

    rrrrhoi

    Joined:
    Jun 4, 2014
    Posts:
    9

    this is that parent page (it has broken link) -> https://unionassets.com/iosnative/push-notifications-14

    sorry my poor english. but fix this please..
     
    Last edited: Feb 13, 2015