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

Robovm crash [GADInterstitial initWithAdUnitID:]: unrecognized selector sent to instance #78

Closed
tzvetkovg opened this issue Nov 21, 2016 · 7 comments
Labels

Comments

@tzvetkovg
Copy link

@tzvetkovg tzvetkovg commented Nov 21, 2016

Hello,

I am trying to run my app for ios (latest xcode 8,ios 10, iphone 6 simulator) with admob. I followed this guide https://github.com/florianf/robovm-robopods/tree/master/google-mobile-ads/ios. But I am getting the following stacktrace error. Any help?

objc[4354]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x123a28998) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x12384dd38). One of the two will be used. Which one is undefined.
2016-11-22 01:34:37.136 IOSLauncher[4354:200034] [debug] IOSApplication: iOS version: 10.1
2016-11-22 01:34:37.136 IOSLauncher[4354:200034] [debug] IOSApplication: Running in 64-bit mode
2016-11-22 01:34:37.138 IOSLauncher[4354:200034] [debug] IOSApplication: scale: 2.0
2016-11-22 01:34:37.140 IOSLauncher[4354:200034] [debug] IOSApplication: Status bar is not visible
2016-11-22 01:34:37.140 IOSLauncher[4354:200034] [debug] IOSApplication: Total computed bounds are w=1334.0 h=750.0
2016-11-22 01:34:37.225 IOSLauncher[4354:200034] [debug] IOSGraphics: Display: ppi=264, density=1.65
2016-11-22 01:34:37.232 IOSLauncher[4354:200034] Error: -[IOSVersion init]: Cannot parse iOS version string "10.1"
2016-11-22 01:34:37.865 IOSLauncher[4354:200034] [debug] IOSApplication: created
2016-11-22 01:34:37.926 IOSLauncher[4354:200034] [debug] IOSApplication: resumed
2016-11-22 01:34:37.928 IOSLauncher[4354:200034] [debug] IOSApplication: Status bar is not visible
2016-11-22 01:34:37.928 IOSLauncher[4354:200034] [debug] IOSApplication: Total computed bounds are w=1334.0 h=750.0
2016-11-22 01:34:37.929 IOSLauncher[4354:200034] [debug] IOSApplication: Status bar is not visible
2016-11-22 01:34:37.929 IOSLauncher[4354:200034] [debug] IOSApplication: Total computed bounds are w=1334.0 h=750.0
2016-11-22 01:34:37.980 IOSLauncher[4354:200034] -[GADInterstitial initWithAdUnitID:]: unrecognized selector sent to instance 0x608001261440
2016-11-22 01:34:38.070 IOSLauncher[4354:200034] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GADInterstitial initWithAdUnitID:]: unrecognized selector sent to instance 0x608001261440'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000011356734b __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x0000000113d5121e objc_exception_throw + 48
	2   CoreFoundation                      0x00000001135d6f34 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
	3   CoreFoundation                      0x00000001134ecc15 ___forwarding___ + 1013
	4   CoreFoundation                      0x00000001134ec798 _CF_forwarding_prep_0 + 120
	5   IOSLauncher                         0x000000010ca52273 [J]org.robovm.pods.google.mobileads.GADInterstitial.$m$initWithAdUnitID$(Lorg/robovm/pods/google/mobileads/GADInterstitial;Lorg/robovm/objc/Selector;Ljava/lang/String;)J + 177
	6   IOSLauncher                         0x000000010ca515f3 [J]org.robovm.pods.google.mobileads.GADInterstitial.init(Ljava/lang/String;)J + 88
	7   IOSLauncher                         0x000000010ca512d7 [J]org.robovm.pods.google.mobileads.GADInterstitial.<init>(Ljava/lang/String;)V + 62
	8   IOSLauncher                         0x000000010c3bd882 [J]com.saveggs.game.ViewController.createAndLoadInterstitial()Lorg/robovm/pods/google/mobileads/GADInterstitial; + 55
	9   IOSLauncher                         0x000000010c3bdac4 [J]com.saveggs.game.ViewController.loadAds()V + 25
	10  IOSLauncher                         0x000000010c3bda9c [J]com.saveggs.game.ViewController.loadInterstitialAd()V + 17
	11  IOSLauncher                         0x000000010c3c5106 [J]com.saveggs.game.screens.SplashScreen.<init>(Lcom/admob/AdsController;Lcom/saveggs/game/GameClass;Z)V + 918
	12  IOSLauncher                         0x000000010c3b31a4 [J]com.saveggs.game.GameClass.create()V + 132
	13  IOSLauncher                         0x000000010c1f4756 [J]com.badlogic.gdx.backends.iosrobovm.IOSGraphics.draw(Lorg/robovm/apple/glkit/GLKView;Lorg/robovm/apple/coregraphics/CGRect;)V + 315
	14  IOSLauncher                         0x000000010c1f5951 [J]com.badlogic.gdx.backends.iosrobovm.IOSGraphics$1.draw(Lorg/robovm/apple/coregraphics/CGRect;)V + 38
	15  IOSLauncher                         0x000000010c1f5a21 [J]com.badlogic.gdx.backends.iosrobovm.IOSGraphics$1.$cb$drawRect$(Lcom/badlogic/gdx/backends/iosrobovm/IOSGraphics$1;Lorg/robovm/objc/Selector;Lorg/robovm/apple/coregraphics/CGRect;)V + 22
	16  IOSLauncher                         0x000000010c1f57c2 [j]com.badlogic.gdx.backends.iosrobovm.IOSGraphics$1.$cb$touchesMoved$withEvent$(Lcom/badlogic/gdx/backends/iosrobovm/IOSGraphics$1;Lorg/robovm/objc/Selector;JLorg/robovm/apple/uikit/UIEvent;)V[callback] + 500
	17  IOSLauncher                         0x000000010c1f582b [j]com.badlogic.gdx.backends.iosrobovm.IOSGraphics$1.$cb$touchesMoved$withEvent$(Lcom/badlogic/gdx/backends/iosrobovm/IOSGraphics$1;Lorg/robovm/objc/Selector;JLorg/robovm/apple/uikit/UIEvent;)V[callback] + 605
	18  QuartzCore                          0x000000011142fa62 _ZN2CA5Layer7displayEv + 140
	19  QuartzCore                          0x000000011142457e _ZN2CA5Layer17display_if_neededEPNS_11TransactionE + 294
	20  QuartzCore                          0x0000000111424611 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 35
	21  QuartzCore                          0x00000001113b2680 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280
	22  QuartzCore                          0x00000001113df767 _ZN2CA11Transaction6commitEv + 475
	23  QuartzCore                          0x00000001113e00d7 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 113
	24  CoreFoundation                      0x000000011350be17 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
	25  CoreFoundation                      0x000000011350bd87 __CFRunLoopDoObservers + 391
	26  CoreFoundation                      0x00000001134f04b6 CFRunLoopRunSpecific + 454
	27  UIKit                               0x0000000111c207e6 -[UIApplication _run] + 434
	28  UIKit                               0x0000000111c26964 UIApplicationMain + 159
	29  IOSLauncher                         0x000000010c8c6520 [J]org.robovm.apple.uikit.UIApplication.main(ILorg/robovm/rt/bro/ptr/BytePtr$BytePtrPtr;Ljava/lang/String;Ljava/lang/String;)I + 195
	30  IOSLauncher                         0x000000010c8c5a2b [J]org.robovm.apple.uikit.UIApplication.main([Ljava/lang/String;Ljava/lang/Class;Ljava/lang/Class;)V + 944
	31  IOSLauncher                         0x000000010c8c4b04 [j]org.robovm.apple.uikit.UIApplication.main([Ljava/lang/String;Ljava/lang/Class;Ljava/lang/Class;)V[clinit] + 68
	32  IOSLauncher                         0x000000010c3bd4c5 [J]com.saveggs.game.IOSLauncher.main([Ljava/lang/String;)V + 74
	33  IOSLauncher                         0x000000010ca8c30e _call0 + 142
	34  IOSLauncher                         0x000000010ca81678 callVoidMethod + 104
	35  IOSLauncher                         0x000000010ca83d84 rvmCallVoidClassMethodA + 269
	36  IOSLauncher                         0x000000010ca83e58 rvmCallVoidClassMethod + 134
	37  IOSLauncher                         0x000000010ca7c197 rvmRun + 217
	38  IOSLauncher                         0x000000010ca71ce0 main + 301
	39  libdyld.dylib                       0x0000000113a0568d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

The actual admob code

@CustomClass("ViewController")
public class ViewController  extends UIViewController implements AdsController {
	
	    private GADInterstitial interstitial;
	    
	    @Override
	    public void viewDidLoad() {
	        super.viewDidLoad();
	        interstitial = createAndLoadInterstitial();
	    }

	    private GADInterstitial createAndLoadInterstitial() {
	        GADInterstitial interstitial = new GADInterstitial("XXXXXXXX");
	        interstitial.setDelegate(new GADInterstitialDelegateAdapter() {
	            @Override
	            public void didDismissScreen(GADInterstitial ad) {
	                ViewController.this.interstitial = createAndLoadInterstitial();
	            }
	        });
	        interstitial.loadRequest(createRequest());
	        return interstitial;
	    }

	    private GADRequest createRequest() {
	        GADRequest request = new GADRequest();
	        // To test on your devices, add their UDIDs here:
	        request.setTestDevices(Arrays.asList(GADRequest.getSimulatorID()));
	        return request;
	    }

	    @IBAction
	    private void didTapInterstitialButton(UIButton sender) {
	        if (interstitial.isReady()) {
	            interstitial.present(this);
	        } else {
	            System.out.println("Interstitial not ready!");
	        }
	    }
		@Override
		public void showBannerAd() {	
		}

		@Override
		public void hideBannerAd() {
		}

		@Override
		public boolean isWifiConnected() {
			return true;
		}

		@Override
		public void showInterstitialAd(Runnable then) {
	/*		runOnUiThread(new Runnable() {
		           @Override
		           public void run() {
		                   interstitialAd.setAdListener(new AdListener() {
		                       @Override
		                       public void onAdClosed() {
		                    	   interstitialAdNotLoadedOrClosed(then);
		                       }
		                   });
		                if(interstitialAd.isLoaded())
		                	showAds(); 
		                else
		                	interstitialAdNotLoadedOrClosed(then);
		           }
		       }); */
			showAds();
		}

		@Override
		public boolean isMobileDataEnabled() {
			return true;
		}

		@Override
		public void loadInterstitialAd() {
			loadAds();
		}
	
		
		public void loadAds() {
		     interstitial = createAndLoadInterstitial();
		 }
		
		 public void showAds() {
		     if (interstitial.isReady()) {
		         interstitial.present(UIApplication.getSharedApplication().getKeyWindow().getRootViewController());
		     } else {
		         System.out.println("Interstitial not ready!");
		     }
		 }

My build gradle is as follows

[](buildscript {
project.ext.roboVMVersion = "2.2.1-SNAPSHOT"
project.ext.roboVMGradleVersion = "2.2.1-SNAPSHOT"
project.ext.robopodsVersion = "1.14.0"

repositories {
    mavenCentral()
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
    jcenter()
}
dependencies {
    classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
    classpath 'com.android.tools.build:gradle:2.1.3'
    classpath group: 'com.mobidevelop.robovm', name: 'robovm-gradle-plugin', version: project.roboVMGradleVersion
}

}

allprojects {
apply plugin: "eclipse"
apply plugin: "idea"

version = '1.0'
ext {
    appName = 'SaveTheEggs'
    gdxVersion = '1.9.4'
    box2DLightsVersion = '1.3'
    ashleyVersion = '1.4.0'
    aiVersion = '1.5.0'
	gdxUtilsVersion = '0.11.0'
	roboVMVersion = '2.2.1-SNAPSHOT'
	gdxPayVersion = '0.10.3'
	
}

repositories {
    mavenCentral()
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
    maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}

}

project(":android") {
apply plugin: "android"

configurations { natives }

dependencies {
    compile project(":core")
    compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
    natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
    natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
    natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
    compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
    natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
    natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
    natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
    compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
    compile "com.badlogicgames.gdx:gdx-controllers-android:$gdxVersion"
    compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
    natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
    natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
    natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
compile "net.dermetfan.libgdx-utils:libgdx-utils:$gdxUtilsVersion"
    compile "net.dermetfan.libgdx-utils:libgdx-utils-box2d:$gdxUtilsVersion" 
compile "com.badlogicgames.gdxpay:gdx-pay-android:$gdxPayVersion"
compile "com.badlogicgames.gdxpay:gdx-pay-android-googleplay:${gdxPayVersion}@aar"

	
}

}

project(":desktop") {
apply plugin: "java"

dependencies {
    compile project(":core")
    compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
    compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
    compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
    compile "com.badlogicgames.gdx:gdx-controllers-desktop:$gdxVersion"
    compile "com.badlogicgames.gdx:gdx-controllers-platform:$gdxVersion:natives-desktop"
    compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
    compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
	

}

}

project(":ios") {
apply plugin: "java"
apply plugin: "robovm"

repositories {
	mavenCentral()
	maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}

dependencies {
    compile project(":core")
	compile group: 'com.mobidevelop.robovm', name: 'robovm-rt', version: project.roboVMVersion
	compile group: 'com.mobidevelop.robovm', name: 'robovm-cocoatouch', version: project.roboVMVersion
compile "org.robovm:robopods-google-mobile-ads-ios:$robopodsVersion"

    compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
    compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
    compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-ios"
    compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios"
    compile "com.badlogicgames.gdxpay:gdx-pay-iosrobovm-apple:$gdxPayVersion"
}

}

project(":html") {
apply plugin: "gwt"
apply plugin: "war"

dependencies {
    compile project(":core")
    compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
    compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
    compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
    compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion:sources"
    compile "com.badlogicgames.gdx:gdx-box2d-gwt:$gdxVersion:sources"
    compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion:sources"
    compile "com.badlogicgames.gdx:gdx-controllers-gwt:$gdxVersion"
    compile "com.badlogicgames.gdx:gdx-controllers-gwt:$gdxVersion:sources"

}

}

project(":core") {
apply plugin: "java"

dependencies {
    compile "com.badlogicgames.gdx:gdx:$gdxVersion"
    compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
    compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
    compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
	compile "net.dermetfan.libgdx-utils:libgdx-utils:$gdxUtilsVersion"
    compile "net.dermetfan.libgdx-utils:libgdx-utils-box2d:$gdxUtilsVersion" 
	compile "com.badlogicgames.gdxpay:gdx-pay-client:$gdxPayVersion"

}

}

tasks.eclipse.doLast {
delete ".project"
})

my robovm.xml looks like

http://pastebin.com/1vdiRCrt

@florianf
Copy link
Collaborator

@florianf florianf commented Nov 22, 2016

Try to use the latest Mobidevelop Robopods: https://github.com/MobiDevelop/robovm-robopods

Your build.gradle references the original robopods.

@tzvetkovg
Copy link
Author

@tzvetkovg tzvetkovg commented Nov 22, 2016

I've tried switching to the mobidevelop robopods 2.2.1-SNAPSHOT but still getting the same issue. Is the mobidevelop robovm stable for ios 10 and xcode8 ?

@florianf
Copy link
Collaborator

@florianf florianf commented Dec 3, 2016

@Tom-Ski Can you take a look at this? It seems something is wrong in the binding (unknown selector sent).

@Tom-Ski
Copy link
Member

@Tom-Ski Tom-Ski commented Dec 4, 2016

The current issue is invalid, I spoke to OP on irc and asked to update with the correct info (use our robopods instead and update the test and stacktrace accordingly) That hasn't been done, so there isn't much I can look into any further. I'm currently using the latest build of the admob binding and I dont see this issue.

@AshTNA
Copy link

@AshTNA AshTNA commented Dec 4, 2016

@Tom-Ski It's because he is using the MobiDevelop fork of RoboVM, which is based off of RoboVM 1.8.0 so the 1.14.0 robopod doesn't work.

@florianf
Copy link
Collaborator

@florianf florianf commented Dec 4, 2016

@Tom-Ski OK, thanks for your feedback. Closing, OP please update a New issue with the updated infos.

@florianf florianf closed this Dec 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.