我正在尝试在iPhone应用程序的UIWebView中查看facebook-comments插件.
我从Facebook的iOS教程开始,在那里我实现了Single Sign-On.应用代表负责Facebook的单点登录,然后将我重定向到我的单个视图控制器,该控制器显示标题栏和UIWebView.
我使用名为"comments.html"的本地文件加载webview,该文件已添加并复制到我的bundle/project目录中.
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"comments" ofType:@"html"] isDirectory:NO];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
Run Code Online (Sandbox Code Playgroud)
我的html文件是插件实现的简单版本,在Facebook Comments Plugin描述网站上生成.我插入了一个网址并点击了"获取代码".我拿了他们提供给我的HTML5代码,然后把它放在一个html文件中
<html>
<body>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-comments" data-href="http://www.bombslo.com" data-num-posts="4" data-width="470"></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
UIWebView在我的模拟器上加载得很好.我在我的设备上托管并启动了html,它在Safari中运行良好.问题是UIWebView不会在嵌入式UIWebView中加载Facebook-comments插件.
需要注意的一点是,我没有得到一个空白的屏幕.我看到两个动画加载栏,典型的Facebook.另请注意,Facebook生成的代码同时包含HTML5和XFBML.我试过用这两个.
宣言:
char ch = '';
Run Code Online (Sandbox Code Playgroud)
当我这样做时,我得到错误'空字符文字'.
字符串声明:
String str = "";
Run Code Online (Sandbox Code Playgroud)
我认为对String没有错误.
问题是,为什么没有类似的错误出现在String的声明中,或者为什么声明空字符会产生这样的错误,其中空字符串被传递
随着Git的2.10的新选项来[--push选项=] 。创建裸仓库时,会在 hooks 目录中自动创建post-receive.sample,内容如下:
#!/bin/sh
#
# An example hook script to make use of push options.
# The example simply echoes all push options that start with 'echoback='
# and rejects all pushes when the "reject" push option is used.
#
# To enable this hook, rename this file to "pre-receive".
Run Code Online (Sandbox Code Playgroud)
我尝试了以下步骤
git push --push-option=echoback=Hello_world正如示例所说,它放回了Hello_world我的终端。
Git Hook 手册说我可以发送多个选项,--push-option=这些选项将按照GIT_PUSH_OPTION_0, GIT_PUSH_OPTION_1,...手册的建议提供。
我的问题是我应该如何传递多个选项?可以通过 --push-option=
尝试的选项:
git …我正在尝试在其中注入一些值[String: Any]以供以后使用。
我的代码的简约示例:
var info = ["Person" : [
"Age" : 20,
"Name" : "Ratul Sharker"
]]
print(info)
if var person = info["Person"] as? [String:Any] {
person["height"] = 5.5
print("~~> Height injected")
//
// however if i reassign the
// person into the info, then
// the info appear into the print
// info["Person"] = person
}
print(info)
Run Code Online (Sandbox Code Playgroud)
代码也分享在这里
这段代码的输出给了我
["Person": ["Age": 20, "Name": "Ratul Sharker"]]
~~> Height injected
["Person": ["Age": 20, "Name": "Ratul Sharker"]]
Run Code Online (Sandbox Code Playgroud)
显然height …
是否可以更改Objective-C从 Xcode 构建的iPhone 应用程序的标签栏徽章颜色?它总是以红色出现。谁能指导我整理一下?
谢谢
这两个HTTP标头有什么区别?
我有一个使用Marshal的代码.
class MediaModel: Unmarshaling {
var id: Int64
var videoUrl: String?
var text: String?
required init(object: MarshaledObject) throws {
id = try object <| "id"
videoUrl = try? object <| "videos.original_url"
text = try? object <| "text"
}
}
Run Code Online (Sandbox Code Playgroud)
什么<|代表这里?
提前致谢.