菜鸟教程小白 发表于 2022-12-11 20:50:28

iphone - FBRequest 委托(delegate)方法请求 :didLoad: is not getting called


                                            <p><p>我正在使用 Facebook ios sdk 进行共享,我需要获取用户基本信息,例如 userName 我正在执行以下操作,
在@界面中</p>

<pre><code>@interface ViewController : UIViewController&lt;FBRequestDelegate,FBDialogDelegate,FBSessionDelegate&gt;
--------
@property (nonatomic,retain) FBRequest *fbRequestObj;
</code></pre>

<p>在@实现中</p>

<pre><code>- (void)viewDidLoad
{
    fbRequestObj = [ init];
    ;
    ;
}

- (void)request:(FBRequest *)request didLoad:(id)result {
    NSString* name = ;
    userName = ;      
}
</code></pre>

<p>但我的问题是上面的 FBRequest 委托(delegate)在任何情况下都没有被调用。我的实现方式是否正确?如果不是请指导我。
任何帮助都提前致谢。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>您分配/初始化 <code>FBRequest</code> 对象的方式看起来不正确。<br/>
根据 <a href="http://developers.facebook.com/docs/reference/iossdk/request/" rel="noreferrer noopener nofollow">documentation</a> ,您可以尝试执行以下操作:</p>

<pre><code>-(void)viewDidLoad
{
    /* create the params dictionary */
    self.fbRequestObj = [FBRequest requestWithParams:yourParamsDictionary
                                          delegate:self];
    ;
}
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于iphone - FBRequest 委托(delegate)方法请求 :didLoad: is not getting called,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/8699201/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/8699201/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: iphone - FBRequest 委托(delegate)方法请求 :didLoad: is not getting called