Libgdx - 无法使用Google登录RoboPods使用Web视图登录

时间:2016-04-25 07:29:11

标签: ios libgdx robovm

我正在使用LibGDX& Eclipse设置。我已成功使用robopods 1.14.0登录,但是这种方法是通过Safari Web浏览器而不是Web View进行的,这使得它毫无意义。

我已经多次尝试解决此问题,并提到了其他各种帖子,到目前为止似乎没有任何工作。

在我的IOS Launcher课程中,我有:

public class IOSLauncher extends IOSApplication.Delegate {

    private GADBannerView bannerView;
    private ViewController viewController;

    @Override
    protected IOSApplication createApplication() {
        IOSApplicationConfiguration config = new IOSApplicationConfiguration();
        return new IOSApplication(new example(new ViewController()), config);
    }

    public static void main(String[] argv) {
        NSAutoreleasePool pool = new NSAutoreleasePool();
        UIApplication.main(argv, null, IOSLauncher.class);
        pool.close();
    }

    @Override
    public boolean didFinishLaunching(UIApplication application,
                                      UIApplicationLaunchOptions launchOptions) {
        // TODO Auto-generated method stub
        boolean b = super.didFinishLaunching(application, launchOptions);
        Foundation.log("IOSLauncher didFinishLaunching()");

        try {

        viewController = new ViewController();
        GIDSignIn.getSharedInstance().setAllowsSignInWithWebView(true);

        viewController.signIn();

        } catch (Exception e) {
            Foundation.log("Error configuring the Google context: " + e);
        }

        return b;
    }

    @Override
    public boolean openURL(UIApplication application, NSURL url, String sourceApplication, NSPropertyList annotation) {
        return GIDSignIn.getSharedInstance().handleURL(url, sourceApplication, annotation);
    }
}

在我的ViewController类中,我有:

public ViewController() {

        GPGManager.getSharedInstance().setStatusDelegate(new GPGStatusDelegateAdapter() {
            @Override
            public void didFinishGamesSignIn(NSError error) {
                Foundation.log("didFinishGamesSignIn(" + error + ")");
            }

            @Override
            public void didFinishGamesSignOut(NSError error) {
                Foundation.log("didFinishGamesSignOut(" + error + ")");
            }

            @Override
            public void didFinishGoogleAuth(NSError error) {
                Foundation.log("didFinishGoogleAuth(" + error + ")");
            }

            @Override
            public boolean shouldReauthenticate(NSError error) {
                Foundation.log("shouldReauthenticate(" + error + ")");
                return false;
            }

            @Override
            public void willReauthenticate(NSError error) {
                Foundation.log("willReauthenticate(" + error + ")");
            }

            @Override
            public void didDisconnect(NSError error) {
                Foundation.log("didDisconnect(" + error + ")");
            }
        });

        GIDSignIn.getSharedInstance().setAllowsSignInWithWebView(true);

        GIDSignIn.getSharedInstance().setUiDelegate(new GIDSignInUIDelegateAdapter() {

            @Override
            public void willDispatch(GIDSignIn signIn, NSError error) {
                Foundation.log("willDispatch()");
            }

            @Override
            public void presentViewController(GIDSignIn signIn, UIViewController viewController) {
                Foundation.log("presentViewController()");

                UIApplication.getSharedApplication().getKeyWindow().getRootViewController()
                        .presentViewController(viewController, true, null);

            }

            @Override
            public void dismissViewController(GIDSignIn signIn, UIViewController viewController) {
                Foundation.log("dismissViewController()");
                viewController.dismissViewController(true, null);
            }
        });

    }

我的信息文件有:

  <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLName</key>
            <string>com.example.game</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>com.example.game</string>
            </array>
        </dict>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLName</key>
            <string>com.googleusercontent.apps.175333595465-123456789</string> 
            <key>CFBundleURLSchemes</key>
            <array>
                <string>com.example.game</string>
                <string>com.googleusercontent.apps.123456789</string>
            </array>
        </dict>
    </array>

这就是我的Robovm.xml的样子:

<frameworks>
    <framework>UIKit</framework>s
    <framework>OpenGLES</framework>
    <framework>QuartzCore</framework>
    <framework>CoreGraphics</framework>
    <framework>OpenAL</framework>
    <framework>AudioToolbox</framework>
    <framework>AVFoundation</framework>
    <framework>SafariServices</framework>
    <framework>WebKit</framework>
     <framework>GoogleOpenSource</framework>
      <framework>GoogleMobileAds</framework>
<framework>GooglePlus</framework>

<framework>GoogleSignIn</framework>
<framework>gpg</framework>

  </frameworks>

最后,要登录我致电:

GPGManager.getSharedInstance().signIn(CLIENT_ID, false); 

我还在资源文件夹中设置了GoogleService-info.plist配置文件。

我正在使用最新的Google登录SDK 3_0_0,我正在使用Google + iOS SDK 1.7.1

如前所述,一切正常,因为我可以登录,但是通过Safari Web浏览器而不是WebView进行,这使得它无用,因为我的应用程序不会被Apple批准。我错过了什么吗?

0 个答案:

没有答案