简体   繁体   English

Facebook IOS SDK无摩擦请求

[英]Facebook IOS SDK Frictionless Requests

There appears to be no way of setting frictionless requests as on for facebook ios sdk. 似乎没有办法像facebook ios sdk一样设置无间断请求。 For Javascript inplementations this can be done in the fb.init method. 对于Java脚本补全,可以在fb.init方法中完成。

The only other reference to my problem is Facebook Requests Dialog: Frictionless Requests in native iOS app possible? 关于我的问题的唯一其他参考是Facebook请求对话框:在本机iOS应用中可以进行无摩擦请求吗? where it states that frictionless just works when not in sandbox mode. 它指出无摩擦仅在不在沙盒模式下才起作用。

Has anyone else found this to be the case? 有没有其他人发现这种情况?

This call enables frictionless requests: 此调用启用无摩擦请求:

[facebook enableFrictionlessRequests];

But it is not enough to prevent all dialogs from appearing briefly. 但这还不足以阻止所有对话框短暂出现。 Since the frictionless recipient cache is by default not loaded until the first dialog appears. 由于默认情况下不会加载无摩擦收件人缓存,直到出现第一个对话框。 Once the first dialog appears, the frictionless recipient list will be loaded and subsequent dialogs won't appear. 一旦出现第一个对话框,就会加载无摩擦的收件人列表,并且随后的对话框将不会出现。 However, you can call 但是,您可以致电

[facebook reloadFrictionlessRecipientCache]; 

after a successful login to have the frictionless recipient cache ready before the first dialog appears. 成功登录后,可以在第一个对话框出现之前准备好无摩擦的收件人缓存。

Franco 佛朗哥

In newer version (2/25/2012 and newer) of the facebook-ios-sdk, there is a new FBFrictionlessRequestSettings which you can enable once, and then all future apprequests will automatically be frictionless. 在facebook-ios-sdk的较新版本(2012年2月25日及更新)中,有一个新的FBFrictionlessRequestSettings可以启用一次,然后所有以后的请求将自动变为无摩擦。 So when your app starts, you should do: 因此,当您的应用启动时,您应该执行以下操作:

[facebook enableFrictionlessRequests];

I prefer this over manually setting the @"frictionless" key to 1 because when you send an apprequest, you will still briefly see the FBDialog pop up and then disappear. 与手动将@“ frictionless”键设置为1相比,我更喜欢这样做,因为发送请求时,您仍然会短暂看到FBDialog弹出然后消失的消息。 If you do 'enableFrictionlessRequests', Facebook.m will automatically set the 'isViewInvisible' param for you and prevent the FBDialog from flashing. 如果您执行“ enableFrictionlessRequests”,Facebook.m将自动为您设置“ isViewInvisible”参数,并防止FBDialog闪烁。

Frictionless requests can be turned on by setting the "frictionless" parameter of the apprequests dialog to "1". 通过将apprequests对话框的“ frictionless”参数设置为“ 1”,可以打开无摩擦请求。 For example; 例如;

// create a dictionary for our dialog's parameters
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity: 7];

// set the frictionless requests parameter to "1"
[params setObject: @"1" forKey:@"frictionless"];

// ... add other parameters ...

// show the request dialog
[facebook dialog:@"apprequests" andParams:params andDelegate: nil];

I think this also answers Frictionless Requests on iOS - how? 我认为这也可以回答iOS上的无摩擦请求-怎么样?

Now with the Facebook iOS SDK 3.2.1, you can use frictionless requests without using the deprecated headers. 现在,使用Facebook iOS SDK 3.2.1,您可以使用无摩擦请求,而无需使用不赞成使用的标头。 Please check out the BooleanOGSample for implementation detials. 请签出BooleanOGSample以获得实现细节。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM