开发者

Difficulty with GwtFB

开发者 https://www.devze.com 2023-03-13 19:41 出处:网络
I successfully checked out GwtFB and ran the project in GWT 2.3. However, I try to copy it to my own project, and it fails with the following error:

I successfully checked out GwtFB and ran the project in GWT 2.3. However, I try to copy it to my own project, and it fails with the following error:

com.google.gwt.core.client.JavaScriptException: (TypeError): Cannot call method 'appendChild' of undefined
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:237)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:132)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:289)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
    at com.foo.client.sdk.FBCore.init(FBCore.java)
    at com.foo.client.bar.onModuleLoad(bar.java:39)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)
    at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:193)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510)
    at com.google.gwt.dev.sh开发者_如何学Cell.BrowserChannelServer.run(BrowserChannelServer.java:352)
    at java.lang.Thread.run(Thread.java:662)

The line in my code where it fails:

private static final String ApiKey = "myKey";

private FBCore fbCore = GWT.create(FBCore.class);
private FBEvent fbEvent = GWT.create(FBEvent.class);

private boolean status = true;
private boolean xfbml = true;
private boolean cookie = true;

private MainView mainView;

/**
 * This is the entry point method.
 */
public void onModuleLoad() {
    fbCore.init(ApiKey, status, cookie, xfbml); // fails
            ...

I've tried to copy every detail from the sample project to my own. What am I doing wrong?


Did you forget to include the following in your html file ?

<div id='fb-root'></div> 
    <script src='http://connect.facebook.net/en_US/all.js'></script> 
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号