Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

iAd Plugin for Unity

Discussion in 'iOS and tvOS' started by jonaphin, Jul 8, 2010.

  1. jonaphin

    jonaphin

    Joined:
    Dec 31, 2008
    Posts:
    209
  2. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    228
    Hey Jonaphin, I recently bought your plugin. Is there anyway to quickly disable or unpatch the xCode project? I've read through this post and most of the documentation and couldn't find that anywhere.

    Also, even when I delete the prefabs from the scene, I still have ads appearing at the top.
     
  3. jonaphin

    jonaphin

    Joined:
    Dec 31, 2008
    Posts:
    209
    Hi rstorm001,

    The easiest way to disable the plugin is to remove the lines 800 to 804 in ApplicationController.mm

    As far as stopping the banner from showing, you will have to call iAd4Unity.HideBanner() in the Awake() method of one of your scripts.

    The next iteration of the plugin, which is now being tested will come with the banner ad hidden by default.
     
  4. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    228
    Line 800 to me is

    printf_console("-> applicationWillTerminate()\n");


    I don't see anything about iAD4unity near that. What do the lines of code actually say so I can search those. I really need to be able to disable this for the project I'm working on.
     
  5. jonaphin

    jonaphin

    Joined:
    Dec 31, 2008
    Posts:
    209
    ah... well, the 4 lines right underneath [self startUnity:YES];
     
  6. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    228
    The best way I found to disable the plugin on the xcode project was to build and run a completely new project.

    But beforehand I changed the folder in my unity project called Editor to Editorsss because that disables the default plugin install location right?

    This is not too hard of a work around, but I just wish there was a way to quickly take this in and out without scrapping project files. Can you PM me on this?

    thanks
     
  7. jonaphin

    jonaphin

    Joined:
    Dec 31, 2008
    Posts:
    209
    A new version (v1.5) of the plugin is out!

    New features:
    - An Orientation API: You can now orient your banner ads to any of the following:
    - Portrait
    - Portrait Upside Down
    - Landscape Left
    - Landscape Right
    - You can query the plugin for banner visibility and it will return true only if a banner is currently being displayed
    - Banners will not show on application launch. You will have to either drag one of the ShowBanner(Top/Bottom) prefabs onto your scene, or call one of the ShowBanner methods programmatically.

    Thanks again to all of you for your support and suggestions :D
     
  8. iEarthHero1

    iEarthHero1

    Joined:
    Jul 28, 2009
    Posts:
    301
    I bought your plugin previously.

    But where do I go or how do I upgrade?

    All I see is a screen with a pay button.

    Thanks.
     
  9. jonaphin

    jonaphin

    Joined:
    Dec 31, 2008
    Posts:
    209
    I sent an email to all users that purchased it. If you didn't receive it please PM me the PayPal email you used along with your email address :)
     
  10. Crunshii

    Crunshii

    Joined:
    May 10, 2010
    Posts:
    4
    Hey Jonaphin!

    Thanks allot for the plugin update! It made a world of difference and now I can rotate my banners within my game.

    One question, i'm trying to check if the banner is displaying to the user. Do you know if this feature is available in the current version?
     
  11. jonaphin

    jonaphin

    Joined:
    Dec 31, 2008
    Posts:
    209
    Hi Crunshii,

    Thank you for the compliments. I take pride in knowing that my plugin is helping you reach your goals. This has always been my objective.

    Regarding your question, you can call:
    Code (csharp):
    1. iAd4Unity.IsBannerVisible();
    I have rewritten its functionality in this latest version so that it only returns true when a banner is actually being displayed rather than when your application is requesting a banner. This way, you can have some alternate content in place when the banner is not displaying.

    More updates and features are coming up shortly as well.
     
  12. daxx2k

    daxx2k

    Joined:
    Aug 10, 2009
    Posts:
    37
    Hey! what about an iPad? it is also working with that ?

    thanks!
     
  13. jonaphin

    jonaphin

    Joined:
    Dec 31, 2008
    Posts:
    209
    The iPad OS is not 4.0 yet, so no iAd for the time being.

    Rumor has it that iOS 4.0 for iPad is planned for November.
     
  14. daxx2k

    daxx2k

    Joined:
    Aug 10, 2009
    Posts:
    37
    Hey I got your plugin but it doesn't seem to work in a brand new project Unity 1.7 or UT3.0 and I don't understand what I'm doing wrong.

    Basically you cannot see any AD until you publish the app on the market?? So there is no way to test it if everything is correct? this may cause a possible broken version on the market??

    or I can use the iAdSimulator to have a sort of feedback, correct? and just delete that object before release the app ?
     
  15. iEarthHero1

    iEarthHero1

    Joined:
    Jul 28, 2009
    Posts:
    301
    I am unsure but I think you might have to be connected to the internet to see the test ad... seems to me I had the same problem until I turned on the Wifi... even then it takes a minute for the ads to start showing.

    Thanks.
     
  16. jonaphin

    jonaphin

    Joined:
    Dec 31, 2008
    Posts:
    209
    Are the iAd.framework and CoreGraphics.framework added to the Frameworks group inside your final Xcode project?
    If they are not, it means that your project was not patched properly. When that is the case you want to make sure Xcode is not running before you build your project and that you do the build by clicking on File > Build Settings > Build
    The next thing to check is usually that your device is connected to the internet. You will also have to let the application run for a little while, as a request for a banner from the application does not mean that you will get a banner served right on the spot.
    Finally, please make sure you have actually dropped one of the prefabs that do initialize the banner to display (try the demo one, it will usually wait about 30 seconds then request its first banner, and do its rotation/position changes).

    If it's still not working for you, PM me and we will take this a notch further.
     
  17. iEarthHero1

    iEarthHero1

    Joined:
    Jul 28, 2009
    Posts:
    301
    @ jonaphin

    I suggest you take what you just wrote and add it to your documentation. I think the users will much appreciate the explanations.

    Thanks.
     
  18. jonaphin

    jonaphin

    Joined:
    Dec 31, 2008
    Posts:
    209
    @iEarthHero1: Great suggestion. Thank you!
    The latest documentation's FAQ now contains a very similar paragraph and is available for download to all current plugin owners at the link that was provided in your purchase/update email. :)
     
  19. daxx2k

    daxx2k

    Joined:
    Aug 10, 2009
    Posts:
    37
    yep I checked already all the other things that you said

    So If I use the iAdUnityDemo+AdBannerBottom I can see a sort of fake banner when I build and run the app in xcode , correct? Then when I'm ready to release the final one to the store I just need to swap the package with the iAdUnity?
     
  20. daxx2k

    daxx2k

    Joined:
    Aug 10, 2009
    Posts:
    37
    Ok I tried with iAdUnityDemo+AdBannerBottom and after a minute, as you said, a "Test Ad" banner pop up but my app is in portrait mode and the banner is in landscape!
     
  21. jonaphin

    jonaphin

    Joined:
    Dec 31, 2008
    Posts:
    209
    If you see the test ads then there is nothing else for you to do. Apple will feed real banners to your app when released.
    The test ads are actually fed to your application by Apple, not by the plugin.
     
  22. daxx2k

    daxx2k

    Joined:
    Aug 10, 2009
    Posts:
    37
    It's not clear for me now which package I should use: iAdUnityDemo or iAdUnity ?
     
  23. iEarthHero1

    iEarthHero1

    Joined:
    Jul 28, 2009
    Posts:
    301
    @ daxx2k
    It seems that much of you conversation would be more appropriate for private message... just hit the PM button.

    Thanks.
     
  24. jonaphin

    jonaphin

    Joined:
    Dec 31, 2008
    Posts:
    209
    IAd4Unity is the plugin. The demo prefab is just a demonstration of all the features of the actual plugin.
    The demo package contains a script that you can take a look at and literally copy/paste from into your own scripts. The aim of it is to help everyone with using the plugin to its potential.
    So in your case you would use iAd4Unity prefab along with the bottom one.
    I'm actually working on making it a single prefab with options. It's less drag/drop but might make more sense.
     
  25. corpselike

    corpselike

    Joined:
    Dec 8, 2009
    Posts:
    13
    Hi all,

    Sorry to be a real pain but I cannot get OF and iAd to build to xcode using the new postprocessplayer script with the 1 script to run them all posted previously;

    Is there any chance some kind and generous individual can post a project which contains a working solution; this is driving me nuts and I just know I am doing something terribly stupid.

    Thanks in advance.

    Corpse.
     
  26. corpselike

    corpselike

    Joined:
    Dec 8, 2009
    Posts:
    13
    Alrighty then, blond moment has elapsed and I finally got the master postprocessbuildplayer script to call the openfeint and iad scripts, delivers to xcode and compiles beautifully....

    BUT....

    When I build and run openfeint is being correctly shown but alas iAd is not being called and displayed (and I have confirmed the ShowBanner message appears in the xcode debugger).

    any idea's?
     
  27. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    they both overload the category with own app finish launching or alike and as such will never play along unless you merge that too.

    from what I know from a customer though the creator of the iad plugin thought its required or even desireable to protect a $4 plugin by precompiling the whole stuff which means: sorry mate but you will not get there, nothing you can do, as you can't merge the initializers at all.

    hope he will reconsider the insanity cause at the time, the only reasonably usable iAd plugin seems to be prime31s, not this one here
     
  28. jonaphin

    jonaphin

    Joined:
    Dec 31, 2008
    Posts:
    209
    @dreamora: No category is being overloaded here. The actual integration into the Unity application controller is open. I'll see what I can do about what you call "insanity" by making some of the integration code a bit more transparent.

    @corpselike: You may take a look at what is happening in the appcontroller, and if it helps, you could certainly move the code that initializes the iAd plugin around. It's basically creating a view in the main window, and the rest is handled within the plugin itself.
     
  29. corpselike

    corpselike

    Joined:
    Dec 8, 2009
    Posts:
    13
    Thanks dreamora from the speedy reply, i'll just sit here an pretend I understood what you said :)

    @jonaphin: Is there any chance you could test iAd and OF integration as you are the iAd plugin authority and would be best suited to finding a excellent work around for those of us who are xcode challenged.

    P.S. I don't know if it's just my setup but for those who cannot get rob's master script to work I found I needed to add Assets/Editors into the pattenr matching path to ensure it found the ppbs files.
     
  30. jonaphin

    jonaphin

    Joined:
    Dec 31, 2008
    Posts:
    209
    I have been looking into this. Not specifically with OpenFeint though.
    The iPod Controls plugin already implements the approach I want to take with the iAd plugin. I just haven't gotten around to implementing it yet :)
    I'll do my best to push your issue to the top of my queue.
     
  31. corpselike

    corpselike

    Joined:
    Dec 8, 2009
    Posts:
    13
    @ jonaphin: Have you had any success integrating OF and iAd yet?
     
  32. jonaphin

    jonaphin

    Joined:
    Dec 31, 2008
    Posts:
    209
    I haven't tried OF yet, but I have modified the rotation methods to be compatible with weak linking (untested). I'm just trying to figure out a bug that popped up when upgrading the plugin to iOS 4.1 then it's ready to go.
     
  33. haggis

    haggis

    Joined:
    Mar 5, 2010
    Posts:
    91
    I think I am experiencing that bug Jonaphin. I just updated to 4.1 and get the following warning:

    ld: warning: directory '/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/System/Library/Frameworks' following -F not found

    Before I build in Xcode the iAd and CoreGraphics frameworks are highlighted in red.

    I have tried Unity 1.7 and Unity 3 (same warning). If I revert back to 4.0.2 I get no warnings or if I take the plugin out, my app looks fine under 4.1.
     
  34. jonaphin

    jonaphin

    Joined:
    Dec 31, 2008
    Posts:
    209
    Hi Haggis,

    That is not the bug I'm referring to. I'm working as fast as possible to bring it to 4.1 without a hitch, but after 5 days of battling this issue, I may have to dwarf the rotation feature and release, so that the plugin is 4.1 compatible, then patch it appropriately.

    I will probably release tonight and let everyone know.
     
  35. haggis

    haggis

    Joined:
    Mar 5, 2010
    Posts:
    91
    Thanks Jonaphin. Look forward to your update anyway and I'll give it a try and see what happens.

    Cheers.
     
  36. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    how do you setup the observer for the playerprefs based communication without adding a category to hook into the applicationDidFinish launching and setup the observer there?

    didn't think there was a way to get your independent code hooking in and getting initialized without a category through hooking an own applicationDidFinishxxx as all others do, so sorry if I missassumed something there.
     
  37. jonaphin

    jonaphin

    Joined:
    Dec 31, 2008
    Posts:
    209
    I got inspiration from how Agon was doing it; basically injecting the initializer of my plugin inside the application launching method.
     
  38. Kripto

    Kripto

    Joined:
    Feb 12, 2007
    Posts:
    119
    I've checked the dev's site and there is no list of system requirements.
    So just to be clear, this plug in runs fine under Unity iPhone 1.7?
     
  39. jonaphin

    jonaphin

    Joined:
    Dec 31, 2008
    Posts:
    209
    Hi Kripto,

    It does work with Unity iPhone 1.7 basic and pro. However, I'm in the process of updating it to work with iOS 4.1 SDK. It is currently only compatible with iOS 4.0 SDK.
     
  40. jonaphin

    jonaphin

    Joined:
    Dec 31, 2008
    Posts:
    209
    OMG... I just read a DEV post on the Apple forums and I do not know if I should feel relieved or angry. For 7 straight days, I tried to fix a rotation issue that I thought was on my end. Turns out tons of devs are having the same issue on iOS SDK 4.1
    What a waste of precious time; skipped lunches, dinners, and worked the whole weekend to try to resolve an issue that is an iOS SDK bug.
    Well then, I guess it's almost time to release the plugin for iOS 4.1...
    Then off to 4.2 and iPad galore!
     
  41. jonaphin

    jonaphin

    Joined:
    Dec 31, 2008
    Posts:
    209
    Hey guys,

    The iAd plugin for iOS 4.1 SDK has been released.
    Please email me if you purchased and didn't get the update email.
     
  42. kieblera5

    kieblera5

    Joined:
    Nov 10, 2009
    Posts:
    107
    Hey,

    I cannot, for the life of me, get the plugin to work. I added both iAdforUnity and AdBannerBottom prefabs to my scene. They are set at position and rotation all zeros with scale at all ones. Is this incorrect? I use the Build Settings->Build and Run to compile. Both frameworks are in the project as well. I'm compiling for SDK 4.1, but I'm not seeing any test ads. What am I doing wrong?

    Thanks,

    kieblera5
     
  43. jonaphin

    jonaphin

    Joined:
    Dec 31, 2008
    Posts:
    209
    I sent you a PM. Please reply to it as we may have to be more specific.

    I'm also CCing the PM to everyone here so that you guys can benefit from it if you also have a problem:

    --------
    It happens sometimes that the iAd server returns no inventory. Probably 1 out of 5 times (in test mode only).

    If it happens all the time when you launch the game then it's a problem with your setup.

    Try to start a new project and import the plugin into it. Add your current level to the build and build your project. As a precaution, make sure Xcode is closed before you build.
    Please report your results back to me.

    Also, please try adding the demo prefab onto your scene, just to make sure.

    Don't forget that ad banners may not show up right away, sometimes you need to wait up to 30-45 seconds to get an ad back from Apple.
    ----
     
  44. kinzia

    kinzia

    Joined:
    Aug 14, 2010
    Posts:
    18
    just tested it with my project but it seems not work.
    I already put the AdBannerBottom and iAd4Unity prefab to scene and confirmed the "iAd.framework" and "CoreGraphics.framework" is in Xcode. Wifi is on and waited about 5mins on my apps

    but i cannot see any Ad showed in my apps.

    In Xcode, the console showed:
    --------------------------------------------------------------------------------------------------------------------------------------------------
    ShowBannerBottom (Filename: /Users/build/builds/unity-iphone/iphone/Projects/../Runtime/Export/Generated/BaseClass.cpp Line: 1719)
    RotateToLandscapeLeft (Filename: /Users/build/builds/unity-iphone/iphone/Projects/../Runtime/Export/Generated/BaseClass.cpp Line: 1719)
    -> force accelerometer registration
    -> applicationDidBecomeActive()
    2010-10-01 02:40:51.386 myapps[3919:307] New Banner Loaded
    --------------------------------------------------------------------------------------------------------------------------------------------------

    my development tools in unity1.7.0f1basic, xcode 3.2.4 and iphone4 ios4.1

    I can see that my plugin is look something wrong because my"iAd4UniyDemo" Prefabs's icon is look like a "file" icon but not a "box" icon. It cannot be open and drop it to scene.
     
  45. jonaphin

    jonaphin

    Joined:
    Dec 31, 2008
    Posts:
    209
    This means that the banner got returned by Apple and should be showing.

    I will PM you a debug build later on today and we'll take it from here, privately.
     
  46. kinzia

    kinzia

    Joined:
    Aug 14, 2010
    Posts:
    18
    thanks for your fast reply!!
     
  47. jonaphin

    jonaphin

    Joined:
    Dec 31, 2008
    Posts:
    209
    Hi Kinzia,

    I sent out an update that should resolve your prefab issue. The problem was prefabs generated with Unity 3 are not backward compatible.

    To everyone, as usual, if you did not receive the update, please PM me or email me, and I'll get it to you ASAP.
     
  48. minevr

    minevr

    Joined:
    Mar 4, 2008
    Posts:
    1,018
    now 1.61~~
     
  49. kinzia

    kinzia

    Joined:
    Aug 14, 2010
    Posts:
    18
    I have not receive your new update yet. Would you please send it to my email?
    my email is:
    kinzia@gmail.com
     
  50. jonaphin

    jonaphin

    Joined:
    Dec 31, 2008
    Posts:
    209
    @kinzia: Sent.

    A little "side" note.
    If you want to receive instant notification of new posts on this thread (or any other) on the new forum, go to advanced mode (bottom right corner button) and make sure to:
    1/ Check the "Subscribe to this thread and notify me of changes" checkbox
    2/ Select "Instantly, using email" (or whichever fits your needs better)