GithubHelp home page GithubHelp logo

chrisjp / cjpadcontroller Goto Github PK

View Code? Open in Web Editor NEW
202.0 202.0 58.0 37.25 MB

A singleton class providing a simple way to add iAd and AdMob ads to a view controller. Choose one as the default, fall back to the other.

Home Page: http://chrisphillips.co.uk

License: MIT License

Objective-C 98.68% Ruby 0.77% C 0.55%

cjpadcontroller's People

Contributors

chrisjp avatar numen31337 avatar pyrosphere avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cjpadcontroller's Issues

Hidding the banner in one screen

Hi! Is there a way to totally remove the banner from one especific ViewController (mine is the last in the stack of a navcontroller)?

Is there a method that should be called inthat ViewController to acomplish this?

Thanks!

Problem with Layout in Swift implementation

I am trying to implement in a Swift project.
Currently I have problem with it.

  1. When I try to show ads from bottom, it does not show.
    2)When I Set it to top, it shows but just overlay my current layout.

Do you have any idea?

AdMob targeting issue

Currently there is no way to set targeting information for AdMob service, i can help you with it if you have any vision how this should be implemented. I think this part of functionality is very important for the such library.

Status Bar Style default

Hello,

I'm trying to use CJPAdController but when i add it, the status bar is always set to default and it looks bad on my black navigation bar

I want to set it to light content but i can't. it looks like this overwrites it

self.window.rootViewController = [CJPAdController sharedInstance];

Does anyone had the same problem? how to walk around it? Thanks a lot

Status Bar disappears when playing fullscreen video

I am using CJPAdController below a UITabBarController bar items. This is the configuration code written in Swift:

class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.

        CJPAdController.sharedInstance().adNetworks = [1]
        CJPAdController.sharedInstance().adPosition = CJPAdPosition.Bottom
        CJPAdController.sharedInstance().initialDelay = 2.0

        let storyBoard = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle())
        let initViewController = storyBoard.instantiateViewControllerWithIdentifier("InitTabBarController") as UIViewController

        CJPAdController.sharedInstance().startWithViewController(initViewController)
        self.window!.rootViewController = CJPAdController.sharedInstance()
        return true
    }

Everything is working fine but when I play a video with AVPlayerViewController in fullscreen and close the controller, the status bar gets hidden. This is the class I am using:

class PlayerViewController: AVPlayerViewController {

    var file:NSString!

    override func viewDidLoad() {
        super.viewDidLoad()

        let videoURL = NSURL(fileURLWithPath: file)
        self.player = AVPlayer.playerWithURL(videoURL) as AVPlayer

        self.player.play()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

 }

I coding for iOS 8.1

...init adController directly in viewcontroller?

Wondering if it's possible to use CJPAdController directly with any chosen viewController instead of initializing from AppDelegate?
Reason is I'm using RESideMenu (github.com/romaonthego/RESideMenu) with storyboards which already is using rootViewController & embedded NavigationController.

Truly like this AdController, so I followed the storyboard instructions and after building app it simply crashes when starting up on device.

Appreciate any help...

Keep Ad Banner on presenting modal view?

Hi wondering is there a workaround to keeping the ad when presenting modal views? I tried using the '-startWithViewController:' method in the modal vc to switch to the new modal view, but that doesn't work. Thanks

Status bar being hidden

If the controller tries to present when there is currently a push view controller on the stack, then it fails and hides the status bar in the app.

Compilation error

I am trying to use CJPAdController under Xcode 5.1.1 but I got the following compilation error. I am wondering if it is due to Xcode 5 or not. If not, please help me solving this issue. Thank you.
schermata 2015-02-09 alle 16 57 05

iPad iOS 7 wrong device orientation

Hi!

I got a universal app that is working on iPad in landscape mode only. Suddenly, the app shows up in portrait mode, which totally breaks the user experience. Rotating device does not change the orintation. I removed the CJPAdController and it works fine, but I need ads inside.

Please help :(

Using Different Admob Ad Unit IDs?

Using this library, how can I call specific ad units? For example I have a customized ad to use for a specific view, and another ad for another view controller. How can I let the library display the correct one (this is of course assuming admob is the default choice)?

I also was wondering what the proper way of using this is, when my root view controller isn't embedded within a navigation controller or a tab bar controller. I just have a view controller with multiple segues that lead to other view controllers.

Thank you so much for this by the way!

Bugsense crash report

Here is the crash report symbolicated form bugsense of my app.
I was using a version of your class downloaded in december 2012, I'm updating my app now with the most recent commit and will let you know if it happens again.

0 libobjc.A.dylib 0x3afec5b6 objc_msgSend + 21
1 Foundation 0x33d01c15 + 24
2 Foundation 0x33d01ccd + 60
3 Foundation 0x33d07653 + 270
4 Foundation 0x33d079db + 386
5 UIKit 0x3559014f + 346
6 UIKit 0x35155c37 + 562
7 UIKit 0x35198e61 + 52
8 My Bet Slip Live 0x000f9c9d 0xf7000 + 11421
9 UIKit 0x351578c9 + 456
10 QuartzCore 0x34f01d8b + 214
11 QuartzCore 0x34f01929 + 460
12 UIKit 0x35157689 + 728
13 My Bet Slip Live 0x000f9d09 0xf7000 + 11529
14 UIKit 0x3516ae99 + 504
15 UIKit 0x3522214f + 58
16 My Bet Slip Live 0x000fa189 0xf7000 + 12681
17 My Bet Slip Live 0x00148f84 0xf7000 + 335748
18 My Bet Slip Live 0x0014d5e4 0xf7000 + 353764
19 My Bet Slip Live 0x0014bcb4 0xf7000 + 347316
20 My Bet Slip Live 0x0015ad38 0xf7000 + 408888
21 My Bet Slip Live 0x00150214 0xf7000 + 365076
22 My Bet Slip Live 0x00148f84 0xf7000 + 335748
23 My Bet Slip Live 0x00140194 0xf7000 + 299412
24 CoreFoundation 0x3334f9c4 + 68
25 CoreFoundation 0x332a6feb + 286
26 CoreFoundation 0x332a6b43 + 50
27 WebKit 0x39bc0653 + 374
28 CoreFoundation 0x3334e61b + 626
29 CoreFoundation 0x332a5f68 _CF_forwarding_prep_0 + 24
30 CoreFoundation 0x3334f9c4 + 68
31 CoreFoundation 0x332a6feb + 286
32 WebCore 0x392ebcf3 + 26
33 WebCore 0x39328d0d + 80
34 CoreFoundation 0x33321683 + 14
35 CoreFoundation 0x33320ee9 + 212
36 CoreFoundation 0x3331fcb7 + 646
37 CoreFoundation 0x33292ebd CFRunLoopRunSpecific + 356
38 CoreFoundation 0x33292d49 CFRunLoopRunInMode + 104
39 GraphicsServices 0x36e562eb GSEventRunModal + 74
40 UIKit 0x351a8301 UIApplicationMain + 1120
41 My Bet Slip Live 0x000fa5e7 0xf7000 + 13799

Tabview Controller

I can't get this to work in a tab view. I have CJPAdController in all the view controllers. When the app starts the screen is blank and nothing happens until I click on the second tab. I then go back to first tab view and it will then display with the ad. I'm a newbie so maybe I'm doing something wrong. Great work by the way. I learned a lot by studying the code.

Support storyboard?

Hello thank for amazing work.

how add ur code with project built in storyboard.

thank you :)

Can't install when using use_frameworks

If I try to install alongside a library that is written in Swift (Like SwiftyJSON) I get the following error:

Updating local specs repositories
Analyzing dependencies
Downloading dependencies
Installing CJPAdController (1.7)
Using DateTools (1.6.1)
Installing Google-Mobile-Ads-SDK (7.4.1)
Using SwiftyJSON (2.2.1)
[!] The 'Pods' target has transitive dependencies that include static binaries: (/Users/jengo/Projects/tests/CJPAdControllertest/Pods/Google-Mobile-Ads-SDK/GoogleMobileAdsSdkiOS-7.4.1/GoogleMobileAds.framework)

Installing Google-Mobile-Ads-SDK works fine, but fails when CJPAdController is also listed.

Example Podfile I am using

platform :ios, '8.0'

pod "SwiftyJSON", ">= 2.2"
pod 'CJPAdController'
pod 'DateTools'

use_frameworks!
link_with 'CJPAdControllertest'

Exiting a full screen video hides the status bar permanently

Before nothing, thanks for this wonderful tool, it's awesome.
I have configured CJPAdController on my app as the tutorial says and everything seems to be working fine, except when I launch a video, set full screen and then when I click on Done button to exit full screen, the status bar is hidden.

Any suggestion on how to recover the status bar? I tried with [[UIApplication sharedApplication] setStatusBarHidden:NO] on my viewDidDisapear which is triggered when the back button is pressed, but the status bar is not displayed.

No resize main viewcontroller

My app has a UIViewController with ads. When load app and show ad, resize the main view of viewcontroller, but when show mail composer and come back, the main view no resize and the bottom buttons no show, why?

Great work!

Status bar and Banner on top

Hello.
Could you please check this line of code

if (!preiOS7 && !_showingiAd && !_showingAdMob && _adPosition==CJPAdPositionTop) {
        contentFrame.origin.y = statusBarHeight;
        contentFrame.size.height -= statusBarHeight;
}

I am using your controller with a simple UIViewController. I try to set

[CJPAdController sharedInstance].overrideIsNavController = YES;

but it was not good. See below:

Temporarily hiding ads

How could I temporarily hide ads? (in my app I want to implement fullscreen view with no ads on tap)

I only use AdMob, so I could probably do:
[adController removeBanner:@"AdMob" permanently:NO];

but I see no easy way to restore the ad when done?

Ad not shown when custom UIViewController is really a UINavigationController

My app is using an instance of SWRevealViewController as the contentController. This is not working because it is not a UINavigationController.

I think this commit broke it for me:
78ae4f7

When _isNavController to YES, it works for me - so for now I have just modified your code.
I think it is impossible for you to recognize how to behave for custom UIViewControllers, but maybe you could add an override property, to force _isNavController or _isTabBar to YES...

No visible @interface for 'GADrequest' ...

I got another strange error in one of my projects using CJPAdController.
For some reason I get following error: No visible @interface for 'GADrequest' declares the selector tagForChildDirectedTreatment.

Here is the part of code:

    // COPPA
    if ([_tagForChildDirectedTreatment isEqualToString:@"0"] || [_tagForChildDirectedTreatment isEqualToString:@"1"]) {
        BOOL tagForCOPPA = [_tagForChildDirectedTreatment isEqualToString:@"1"] ? YES : NO;
        [adMobRequest tagForChildDirectedTreatment:tagForCOPPA];
    }

I already checked all settings multiple times, but still can't figure out what happened. The same version of CJPAdController works fine in another project.

Removed banner still shows up if canceled before initialDelay time passed

Hello,

A case:

  1. Setup CJPAdController with initialDelay of 60 seconds.
  2. Remove the banner before 60 seconds passed.
  3. The banner will still show up, as it's creation is scheduled.

Solution:

Add this one line below code to removeAdsAndMakePermanent:andRemember:, at the beginning of the method:

[NSObject cancelPreviousPerformRequestsWithTarget:self];

Cheers and thanks for a great lib!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.