小编Tim*_*Tim的帖子

使用App Links Hosting API从iOS应用程序在Facebook上共享链接

我老老实实地花了几个小时试图让它发挥作用.不幸的是,FacebookApp Link的文档还不够清晰.甚至来自F8App Links视频.

应用要求:

  1. 分享FB作为Open Graph故事的链接,用户可以点击该故事将其直接带入我的应用程序并执行特定任务(我的应用程序需要从链接接收特定参数)
  2. 共享而不FB登录的链接FB(即,经由共享对话框,并切换到机iOS FB应用,而不是使用API​​调用).

迄今取得的进展:

我正在使用以下代码来创建托管的应用程序链接(因为我只有移动内容),根据FB开发人员的网站在发布iOS SDK下.

NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
                            @"{My app name}", @"name",
                            {custom URL}, @"al:iphone:url",
                            @"{app store ID}", @"al:iphone:app_store_id",
                            @"{My app name}", @"al:iphone:app_name",
                            @"{\"should_fallback\": false}", @"web",
                            fbAccessToken, @"access_token",
                            nil
                            ];

/* make the API call */
[FBRequestConnection startWithGraphPath:@"/{FB app id}/app_link_hosts"
                             parameters:params
                             HTTPMethod:@"POST"
                      completionHandler:^(
                                              FBRequestConnection *connection,
                                              id result,
                                              NSError *error
                                              ) {
                              /* handle the result */
                              NSLog(@"Result = %@",result);
                              if(error) NSLog(@"error = %@",error); …
Run Code Online (Sandbox Code Playgroud)

facebook opengraph ios applinks

8
推荐指数
1
解决办法
5476
查看次数

延迟将HTML字符串加载到UIWebView中

我在导航控制器中有两个视图控制器.第一个视图控制器有一个带按钮的菜单.按此按钮移动到第二个视图控制器并将html字符串加载到UIWebView中.没有其他任何东西被加载到webview,只是一个带有html代码的简单NSString.基本上我正在使用webview作为其中一个uiviews的子视图制作翻转卡片(两个视图).

这是代码:

containerView = [[UIView alloc] initWithFrame:CGRectMake(20, 20, 280, 280)];
[self.view addSubview:containerView];

frontView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 280, 280)];
frontView.layer.cornerRadius = 10;
frontView.layer.masksToBounds = YES;
[frontView setBackgroundColor:[UIColor whiteColor]];
backView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 280, 280)];
backView.layer.cornerRadius = 10;
backView.layer.masksToBounds = YES;
[backView setBackgroundColor:[UIColor yellowColor]];
[containerView addSubview:frontView];

webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 280, 280)];
webView.scalesPageToFit = YES;
webView.userInteractionEnabled = NO;

NSString *htmlString = @"<head><meta name='viewport' content='width=device-width;'><style type='text/css'>html,body {margin: 0;padding: 0;width: 100%;height: 100%;}html {display: table;}body {display: table-cell;vertical-align: middle;padding: 20px;text-align: …
Run Code Online (Sandbox Code Playgroud)

performance objective-c uiwebview uinavigationcontroller ios

2
推荐指数
1
解决办法
2281
查看次数