Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Anyone interested in accessing the entire iOS SDK API from Unity?

Discussion in 'iOS and tvOS' started by u3dxt, Jul 6, 2013.

  1. yifan024

    yifan024

    Joined:
    Jun 5, 2013
    Posts:
    19
    Is there any way I can receive a device shake event through u3dxt Pro? If yes, a C# sample code please. Thanks
     
  2. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    @petey To get the playlists, you would need to use the low-level MPMediaQuery.PlaylistsQuery() method (http://u3dxt.com/api/?topic=html/M_U3DXT_iOS_Native_MediaPlayer_MPMediaQuery_PlaylistsQuery.htm), and the MPMediaPlaylist class (http://u3dxt.com/api/?topic=html/T_U3DXT_iOS_Native_MediaPlayer_MPMediaPlaylist.htm). The following code is not tested, but gives you an idea:

    Code (csharp):
    1.  
    2. var query:MPMediaQuery = MPMediaQuery.PlaylistsQuery();
    3. var playlists:Array = query.Collections();
    4. for (var i=0; i<playlists.length; i++) {
    5.     var list:MPMediaPlaylist = playlists[i] as MPMediaPlaylist;
    6.     Debug.Log(“playlist name:+ list.Value(MPMediaPlaylist.PropertyName));
    7. }
    8.  
     
  3. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    @rocki We have plans to open up the UIApplication.statusBarHidden property to show and hide the status bar dynamically. Before we add that, you can currently get the battery info using UIDevice.batteryLevel. See example code in Assets/U3DXT/Examples/core/GUIBasics.

    @solo024 U3DXT currently does not support detecting shake events yet. However, it is possible with Unity now. Please see this thread: http://forum.unity3d.com/threads/15029-Iphone-Shaking.
     
  4. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,817
    Thanks u3dxt! Starting to get my head around it all :)

    Just had one more question if you have a minute.

    I was trying to grab an image from the phone's library to use in a shader and I got as far as getting the picker up but how do I receive events like DidFinishPickingMediaWithInfo or DidCancel from within unityscript?
    Code (csharp):
    1.  
    2. function ChoosePic() {
    3.     ImagePicker = new UIImagePickerController();
    4.     UIApplication.SharedApplication().keyWindow.rootViewController.PresentViewController(ImagePicker, true, null);
    5. }
    Thanks,
    Pete
     
  5. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    @petey You can use the high-level GUIXT.ShowImagePicker() method and GUIXT.MediaPicked and GUIXT.MediaPickCancelled events. Please take a look at the example code in Assets/U3DXT/Examples/core/GUIBasics.
     
  6. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,817
    Awesome, thanks again!
     
  7. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,459
    Great, ATM is there also a way to get the phone signal strength?
    btw, is there an ETA on the UIApplication.statusBarHidden property.

    Cheer and keep up the amazing work.
     
  8. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
  9. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,817
    Hi u3dxt,

    Just wondering, is this plugin purely iOS 7 compatible or will some of the features work on older versions? Obviously there are a lot of features that are iOS 7 specific, does that mean we should be only targeting those devices?

    Thanks
    Pete
     
  10. ninjanosui

    ninjanosui

    Joined:
    Jul 12, 2013
    Posts:
    54
    Hi @u3dxt ,

    The webview sample is crashing for me after a couple of website switches. I have read that it is not threadsafe? Is there some way to fix this? (i want to play an embedded youtube vid)

    Regards
    Steven Ramaker
     
    Last edited: Mar 21, 2014
  11. Gizmocracy

    Gizmocracy

    Joined:
    Jan 5, 2013
    Posts:
    10
    I'm using 1.6.4.1, and U3DXT kills stripping on Android. I get a FailedAssembliesStripper exception due to the presence of iPhoneGeneration. All references in my code to iPhoneGeneration and/or U3DXT are walled off in #if UNITY_IOS blocks, and the problem vanishes when I delete U3DXT from the project, so this is an error inside U3DXT. Deleting Assets/link.xml was tried after each change while trying to fix this and never helped.
     
  12. EMOTION-THEORY

    EMOTION-THEORY

    Joined:
    Jul 16, 2013
    Posts:
    83
    Hey u3dxt,

    For some reason when testing my app it seems to crash at startup. Immediately when it hits the home page it will open up the apple id sign in. I did a bit of digging and think it's the call

    IAPXT.init ( ... )

    I started out with IAPTest.cs and modified it a bit, but it's essentially the same thing modified to use my own in-app purchase.

    I'm using a non-consumable IAP. It's set up in iTunes Connect. I've ran the app before successfully and even did some test purchases that worked fine, so I'm not sure if there's some test apple id issue or sandboxing or something.

    Have you had this issue come up before? Any hints or suggestions?

    Much appreciated.

    EDIT:

    I've been doing some fooling around and I made a new IAP to test with. Things seemed to work fine until I tried to buy the IAP again when I already had it. I typed in my password and it said "You have purchased this already, would you like to get it again for free?". Clicking yes caused a crash and now every time I run my app it opens up the "Sign In to iTunes Store" dialog while crashing in XCode. It crashes on a completely separate part of the code to do with Linq -- attemping to JIT compile method ... while running with aot only. Not very useful.

    This is the highlighted line in XCode throwing a EXC_BAD_ACCESS:

    UP_createNSString at UP_Core.m:16

    Could this have something to do with the IAP ID string?

    Man this issue is totally kicking my butt :(
     
    Last edited: Mar 23, 2014
  13. EMOTION-THEORY

    EMOTION-THEORY

    Joined:
    Jul 16, 2013
    Posts:
    83
    This is exactly what I'm getting that I mentioned in my last post. Would love to know if this has been reproduced or if there's any word on it.
     
  14. sparkyman

    sparkyman

    Joined:
    May 3, 2009
    Posts:
    21
    Hi u3dxt , trying to get face detection to work, I have done the following :

    void OnMediaPicked(object sender, MediaPickedEventArgs e) {
    Log("Image picked: " + e.image);

    Texture2D tempTexture = e.image.ToTexture2D();

    FaceDetector faceDetector = new FaceDetector(true, false);

    Face[] features = faceDetector.DetectInImage(tempTexture);
    Debug.Log("features = " + features + " features lenght= " + features.Length);
    }


    Xcode Log
    2014-03-24 17:48:05.261 testApp[1287:60b] Unknown CIDetectorTracking specified. Ignoring.
    features = U3DXT.iOS.CoreImage.Face[] features length= 0

    Can you tell me where I have gone wrong please.

    Sparky
     
  15. MooMoo-Games

    MooMoo-Games

    Joined:
    Jan 10, 2013
    Posts:
    10
    Hello U3DXT,

    I am using your plug-in for storing game data with iCloud.

    I just knew that your iCloud plugin saves the data locally

    even when no user logs in to iCloud in Settings on iOS.

    Actually there is no error when saving or loading data from iCloud with out logged in user.

    I don't want the users to save data in local storage.

    How can I know iCloud is logged on iOS in or not?
     
  16. contempt

    contempt

    Joined:
    Jul 31, 2012
    Posts:
    88
    Volunteering my services to beta test CLBeacon whenever you have it available :)
     
  17. bbigger

    bbigger

    Joined:
    Dec 28, 2011
    Posts:
    6
    I second that!

     
  18. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,459
  19. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    Hi all, we are so sorry for the late reply. Somehow we didn't get notifications for posts on this forum for the last few weeks. We will be going through them today and tomorrow. Also, look forward to a new beta with some of the requested features tomorrow.
     
  20. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    @petey U3DXT supports devices with iOS 5 and up. As long as you use APIs there were introduced before or on iOS 5, then you would have no problem on those devices. However, if you use a new iOS 7 API, then you probably should have an alternative or at least a message telling the user.

    @ninjanosui Please post crash log or call stack, code, and steps to reproduce. BTW, we had a similar problem with web view crashing a few versions ago, but the latest version should be OK.

    @Gizmocracy We will try it and get back to you.
     
  21. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    @acheron studio, Please see page 18 of this thread. Changchun solved it by commenting out the IAPXT.DownloadUpdated line. Another thing to try is to delete the app and reinstall it. Sometimes when you are debugging, you may have stopped the app before letting it complete a transaction. The next time the app starts, it will continue the transaction and may fail somewhere. Deleting the app clears that or you can also try calling IAPXT.RestoreCompletedTransactions().
     
  22. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
  23. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,459

    Common guys, few weeks without checking the forum is not very nice. Anyhow, any news on the status bar that "We hope to have status bar APIs by the end of the month."
     
  24. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    Hi all, we have just released version 1.7.0.0 with the MapKit and CoreBluetooth with iBeacon along with some of the requested features like hide/show status bar. The Unity Asset Store will take about a week to approve. If you want it sooner, PM us with your invoice number and we will give you directions to download it. Or if you already have a version that can directly update from within Unity, you can just go to Assets->U3DXT->Check for Updates.

    Cheers.
     
  25. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,459
    Cool, thanks a bundle.
     
  26. contempt

    contempt

    Joined:
    Jul 31, 2012
    Posts:
    88
    WooHoo!!!
     
  27. SamuZen

    SamuZen

    Joined:
    Jan 26, 2014
    Posts:
    7
    How can i take a screenShot and save it at the ImageRoll ?? and if its possible and how to create a folder for the app..
     
  28. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    @SamuZen For taking a screenshot in Unity, you can take a look at this tutorial: http://unity3d.tutsmobile.com/how-to-take-a-screenshot-and-share-it-on-ios/. Instead of sharing it, you can write it to image roll like this:

    Code (csharp):
    1.  
    2. byte[] data = image.EncodeToPNG();
    3.  
    4. ALAssetsLibrary assetLib = new ALAssetsLibrary();
    5. assetLib.WriteImageDataToSavedPhotosAlbum(NSData.FromByteArray(data), null, delegate(NSURL assetURL, NSError error) {
    6.     if (error != null) {
    7.         Debug.Log(error.LocalizedDescription());
    8.     } else {
    9.         Debug.Log("written to: " + assetURL.AbsoluteString());
    10.     }
    11. });
    12.  
    As for your second question, do you just want to create a folder in the file system for storing data? If so, the .NET framework already gives you APIs in the System.IO namespace: http://msdn.microsoft.com/en-us/library/System.IO(v=vs.110).aspx.
     
  29. zombie_psy

    zombie_psy

    Joined:
    Oct 9, 2012
    Posts:
    62
    .
     
    Last edited: Apr 13, 2014
  30. SamuZen

    SamuZen

    Joined:
    Jan 26, 2014
    Posts:
    7
    Thanks!

    Do you know the better way for the app test if there is any internet connection ? there is something on your sdk to do this ? or this is not a ios specific...
     
  31. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
  32. DokRaphael

    DokRaphael

    Joined:
    Nov 17, 2012
    Posts:
    5
    Hi is there any update for this ? It's been 6 months now
     
  33. a_tarerra

    a_tarerra

    Joined:
    Nov 7, 2012
    Posts:
    16
    Does anyone have suggestions for how to do the following with the MapKit integration?

    1. Update title/position of an annotation without removing it and adding it back in
    2. Set up an annotation callout with a button and get the "CalloutAccessoryControlTapped" working?

    Thanks!
     
  34. TechDevTom

    TechDevTom

    Joined:
    Oct 21, 2011
    Posts:
    33
    Hey u3dxt! I can't believe it's been nearly half a year already since I first asked about the Core Bluetooth framework! I see that you have now put it out there, which I'm quite excited about, so thanks =D

    However, I don't see any documentation yet on your website for it. So my question this time around is, when will there be documentation for the framework on your website? I can see that the API for the framework is there, but do you intend to put documentation and examples up?

    Cheers for all your hard work guys, us hack it types appreciate it =D
     
  35. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    @Jimks, we have an example but there are some issues with memory that we are working on.

    @a_tarerra:
    1. To change the title/position of an annotation, you can modify the Annotation.cs file in the MapsTest example. Add setters for those fields and once those fields are changed, the annotation is updated. You don't have to remove and add them again.
    2. We don't have callout events implemented in the current version. We will put it on our to-do list.

    @TSLoire, we are behind with documentation, however there is a working example of iBeacon in Assets/U3DXT/Examples/bluetooth/iBeaconTest. Since we opened the entire CoreBluetooth framework that mirrors the native iOS SDK, a good starting point is to look at Apple docs. All concepts and functionalities are the same except syntax and we shortened some API names. https://developer.apple.com/library...concepts/AboutCoreBluetooth/Introduction.html, https://developer.apple.com/library...Reference/CoreBluetooth_Framework/_index.html
     
  36. buildandteach_pro

    buildandteach_pro

    Joined:
    Nov 28, 2013
    Posts:
    1
    "Assets/Classes/WelcomeGUI.cs(78,79): error CS0246: The type or namespace name `EventArgs' could not be found."

    The fix for this is to add using System
     
  37. a_tarerra

    a_tarerra

    Joined:
    Nov 7, 2012
    Posts:
    16
    @u3dxt: Thanks for the reply!

    1. Cool, didn't realize it would just pick up changes to title/position. Might be useful to have default setters in the MKAnnotation.coordinate/title virtual properties so that the derived annotation class can have setters too.
    2.That's good to hear, our game sort of depends on it:)

    cheers
     
  38. numnim

    numnim

    Joined:
    Mar 12, 2014
    Posts:
    2
    Can you make this plugin support playmaker ?
     
  39. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    @buildandteach_pro, that class doesn't seem to be in our plugin. But thanks for letting people know about the fix.

    @a_tarerra, thanks for the suggestion. I don't know what we were thinking not adding setters in the first place. We will add it for the next version.

    @numnim, thanks for the suggestion. We will look into this, but we don't have experience creating playmaker support, so no promises now.
     
  40. Greg-S

    Greg-S

    Joined:
    Mar 3, 2012
    Posts:
    7
    @u3dxt

    Hey I was implementing the iCloudprefs into my app when I ran into a question. Namely, the game can be played without an internet connection.

    I was curious how the U3DXT system worked if I saved an icloudprefs value with no internet (but after the user had connected to iCloud, maybe walked into the subway while playing, etc) so I can correctly handle exceptions. Does it store a copy of values locally until an internet connection then sync? or Should I use playerprefs and only sync icloud when there is an internet connection, in which case, unlike gamecenter, I couldn't find any callback when it's connected.

    Thanks.
     
  41. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    @Greg S, our high-level iCloudPrefs caches locally, but it's used to let you know the previous value when a key has changed. Apple's iCloud takes care of internet connectivity. If not connected, it caches locally, and when connected, it automatically syncs. But what you have to do on your end is react to changes after syncing. You do that by subscribing to iCloudPrefs's ValuesChangedExternally event. In some cases, you might have to resolve conflicts with changes. For example, if one device makes a change but it's not connected, while another device makes a different change and syncs to iCloud. When the first device gets connected and syncs to iCloud, your code needs to resolve this conflict depending on what those values represent and logic in your app/game. You can take a look at Assets/U3DXT/Examples/coreextras/iCloudTest for example usage.
     
  42. Greg-S

    Greg-S

    Joined:
    Mar 3, 2012
    Posts:
    7
    Excellent. Thanks!
     
  43. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,459
    Is there a way to get access to the IOS's SQLite?
     
  44. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
  45. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,459
    It seems that from the docs, Core data is more of an in-memory middle layer between the application code and the back end persistent data store. Although most unity projects probably would want this kind of abstraction in C# in order to be platform independent.

    The FMDB project seems interesting. Using this wrapper, in your expert opinion, on a difficulty scale (1-10), what would be the estimated number to integrate with IOS SDK.

    -- Docs -----------------------

    What Core Data Is Not
    Having given an overview of what Core Data is and does, and why it may be useful, it is also useful to correct some common misperceptions and state what it is not.

    Core Data is not a relational database or a relational database management system (RDBMS).

    Core Data provides an infrastructure for change management and for saving objects to and retrieving them from storage. It can use SQLite as one of its persistent store types. It is not, though, in and of itself a database. (To emphasize this point: you could for example use just an in-memory store in your application. You could use Core Data for change tracking and management, but never actually save any data in a file.)
     
  46. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    Hello, I'm trying to find out how to use u3dxt to access iCloud. I see that iCloud is support3d but I can't find any documentation or APIs.
     
  47. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
  48. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    Thanks.
     
  49. GiantGrey

    GiantGrey

    Joined:
    Jul 2, 2012
    Posts:
    266
    Hello, i have two questions:

    i know there is the camera and album picker example, but is it possible to get the generic image picker where you can choose from camera or camera roll?
    And my second question is, how can i get the country code from the device? Is this even possible?
    Thank you
     
  50. ikemen_blueD

    ikemen_blueD

    Joined:
    Jan 19, 2013
    Posts:
    341
    Hi, can you tell me how to achieve these two things:
    - After exporting the file, I want to load it to an Audio Source, is there any example to show how to do it?
    - Is there a way to check if a song has DRM or not?

    Many thanks.
     
    Last edited: May 11, 2014