Search Unity

UnityAds and iOS Simulator

Discussion in 'Unity Ads & User Acquisition' started by coeing, Oct 14, 2014.

Thread Status:
Not open for further replies.
  1. coeing

    coeing

    Joined:
    Mar 17, 2011
    Posts:
    271
    Hi there,

    We are trying to port our game "FreudBot" from Android to iOS right now. I got nearly everything up and running, but one last thing keeps me from starting the game in the iOS simulator. I get a linker error for the DeviceInfo.framework of UnityAds. Here's the detailed error message:
    Guess it would work to build it for a real device, but I want to test it in the simulator first before purchasing an Apple dev license.

    Is there a possibility to run an application with UnityAds in the iOS simulator?
     
  2. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
    Unfortunately, we don't support Unity Ads in iOS simulator. However, it is possible the UnityAds.framework and UnityAds.bundle files weren't copied over to your Xcode project when you built the project in Unity. They should be included in your Unity project directory under Assets/Plugins/iOS. To add these two files to your Xcode project, simply locate them in Finder and drag them onto the Project navigator. This should fix your linker issue.

    Haven't actually tried running an app in the simulator without an iOS developer license. That could also be a potential issue.

    Let me know how it works out.
     

    Attached Files:

  3. coeing

    coeing

    Joined:
    Mar 17, 2011
    Posts:
    271
    Hi Nikkolai,

    Thanks for your answer! It's really sad that the iOS simulator is not supported as it makes testing with the simulator a real pain by having to throw out UnityAds each time.

    It is definitively possible to test with the simulator without a license as it works without UnityAds. The framework and bundle are also included in the project. To me it looks like the DeviceInfo.framework doesn't have a library included for the i386 architecture (probobably only for armv7). So maybe it just needs a little change to make UnityAds work in the simulator. It would definitively improve the dev workflow.

    Cheers
    Christian
     
  4. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    I can't submit my App for Facebook review without providing them with an iOS simulator build. What am I supposed to do in this case? :( Strip out Unity Ads, get it approved, and reimplement it? Hmm..

    @unity-nikkolai I have made sure those 2 files are included in the project, yet the errors persist.
     
    Last edited: Oct 20, 2014
  5. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
    Been doing more research on this issue. Looks like there's a workaround for the i386 architecture issue:
    http://forum.unity3d.com/threads/ios8-xcode6-compatibility.249533/page-2#post-1769753

    As shown in the following code block and attached screenshot, add the selected lines to the end of main.mm in your Xcode project in order to work around the compile time error. Once added, you should be able to build and run your project in iOS Simulator, but still won't be able to initialize Unity Ads since it's not supported with iOS Simulator.

    Code (objc):
    1. #include <time.h>
    2.  
    3. extern "C"
    4. {
    5.     clock_t
    6.     clock$UNIX2003(void)
    7.     {
    8.         return clock();
    9.     }
    10. }
     

    Attached Files:

    Last edited: Oct 21, 2014
  6. CNuttall

    CNuttall

    Joined:
    Feb 8, 2019
    Posts:
    13
    Hi Nikkolai, just a quick question regarding UnityAds in ios Simulator. Even though the Ads aren’t supported on the simulator. I assume the UnityAds would work as normal when the app goes live on the App Store.
     
  7. yes-android-yes

    yes-android-yes

    Joined:
    Jun 17, 2014
    Posts:
    2
    The same problem today after 6 years - the code peovided by Nikolai does not compile properly:
    extern "C"
    Error: expected identifier or "("
     
  8. yes-android-yes

    yes-android-yes

    Joined:
    Jun 17, 2014
    Posts:
    2
    Unity Ads does not support simulator, but developer need to test app on all types of devices, so resolution is simple - drop the unity ads sdk.
     
Thread Status:
Not open for further replies.