Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Mobile Ads 7.0 iOS8 incompatible #22

Open
ancloid opened this issue Feb 17, 2015 · 14 comments
Open

Google Mobile Ads 7.0 iOS8 incompatible #22

ancloid opened this issue Feb 17, 2015 · 14 comments

Comments

@ancloid
Copy link

ancloid commented Feb 17, 2015

I don't know why, but it's not working together in iOS8 ;(
popup just not showing up, without any error

@ancloid
Copy link
Author

ancloid commented Feb 17, 2015

Ok, i found solution. If somebody need it just ask! ;)

@ancloid ancloid changed the title Google Mobile Ads 7.0 incompatible Google Mobile Ads 7.0 iOS8 incompatible Feb 17, 2015
@buddyhut
Copy link

I am getting same issue after adding Google Mobile Ads 7.0

Please help me out how to solve this issue.

Regards
Alok

@buddyhut
Copy link

Hi,
@anclefeudor
Can you Please provide the solution for the same.

Regards
Alok

@tuanphamanh91
Copy link

i have same issue :(
@anclefeudor , @alokfuterox please help.

Thanks advance.

@ancloid
Copy link
Author

ancloid commented Mar 1, 2015

I think Google used same upper view for default popup, so we need to define custom root layer for popup.
As a quick fix i just create a new method:

KLCPopup.h
- (void)showWithRoot:(UIView*)view;

KLCPopup.m

- (void)showWithRoot:(UIView*)view {
    NSDictionary* parameters = @{@"layout" : [NSValue valueWithKLCPopupLayout:KLCPopupLayoutCenter],
                                 @"duration" : @"0.0",
                                 @"root" : view};
    [self showWithParameters:parameters];
}

and replace

if(!self.superview){
        NSEnumerator *frontToBackWindows = [[[UIApplication sharedApplication] windows] reverseObjectEnumerator];

        for (UIWindow *window in frontToBackWindows) {
          if (window.windowLevel == UIWindowLevelNormal) {
            [window addSubview:self];

            break;
          }
        }
      }

with this

if(!self.superview){
          UIView* rootView = [parameters valueForKey:@"root"];
          if(rootView == nil){
              NSEnumerator *frontToBackWindows = [[[UIApplication sharedApplication] windows] reverseObjectEnumerator];

              for (UIWindow *window in frontToBackWindows) {
                  if (window.windowLevel == UIWindowLevelNormal) {
                      [window addSubview:self];
                      break;
                  }
              }
          }else{
              [rootView addSubview:self];
          }
      }

And of course you need to use this method for show popup.
Just create some empty view and use it as root for popup.

Actually it must be fixed - (void)showAtCenter:(CGPoint)center inView:(UIView*)view method, but i'm lazy, sorry...

@tuanphamanh91
Copy link

@anclefeudor thanks for your reply, I've done it 🎉
Again, Thank you so much!

@buddyhut
Copy link

buddyhut commented Mar 2, 2015

@anclefeudor

Thank a lot.
Regards
Alok

@Daltron
Copy link

Daltron commented Mar 28, 2015

Awesome workaround. Thanks a bunch!

@razor28
Copy link

razor28 commented Jun 15, 2015

Thank you for fast fix!

@xarlotie
Copy link

It is still not working for me. I tried it on iOS 7.1 and it's working fine. But on iOS 8.1 and 8.4, nothing is showing up.

@ancloid
Copy link
Author

ancloid commented Aug 26, 2015

Sorry, in 8.4.1 my fix is work. Check your code twice!

@xarlotie
Copy link

I made it work by making self.view of the viewController as rootview.

@sagarsurani
Copy link

Thank you @anclefeudor

@khanh-bh
Copy link

khanh-bh commented Aug 8, 2019

How about this fix?

@@ -541,7 +541,7 @@ - (void)showWithParameters:(NSDictionary*)parameters {
                     NSEnumerator *frontToBackWindows = [[[UIApplication sharedApplication] windows] reverseObjectEnumerator];
                     
                     for (UIWindow *window in frontToBackWindows) {
-                        if (window.windowLevel == UIWindowLevelNormal) {
+                        if (window.windowLevel == UIWindowLevelNormal && !window.isHidden) {
                             [window addSubview:self];
                             
                             break;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants