最近我正在研究如何在Phonegap中添加RSS Feed,我使用了Raymond Camden的教程;它在我的浏览器上工作得很好,所以我决定把它放到xcode中,但我遇到了一个问题;页面上没有内容:(
这就是模拟器的样子:
所以我认为这是一个链接到main.js文件的问题,所以我只是在标题中包含了javascript,但仍然没有。这就是Xcode控制台现在的样子:
你知道我可以做些什么来使这个工作在Xcode上?
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/themes/theme.min.css" />
<link rel="stylesheet" href="jquery.mobile-1.0.min.css" />
<script type="text/javascript" src="jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="jquery.mobile-1.0.min.js"></script>
<script type="text/javascript" src="js/phonegap-1.2.0.js"></script>
<script type="text/javascript">
$.ajaxSetup({
error:function(x,e,errorThrown) {
console.log(x.getStatusCode());
$("#status").prepend("Error!");
}
});
//EDIT THESE LINES
//Title of the blog
var TITLE = "ColdFusion Jedi";
//RSS url
var RSS = "http://pipes.yahoo.com/pipes/pipe.run?_id=cd8204ba72b3220a8278b1c0665cb7c2&_render=rss";
//Stores entries
var entries = [];
var selectedEntry = "";
//listen for detail links
$(".contentLink").live("click", function() {
selectedEntry = $(this).data("entryid");
});
//Listen for main page
$("#mainPage").live("pageinit", function() {
//Set the title
$("h1", this).text(TITLE);
$.get(RSS, {}, function(res, code) {
entries = [];
var xml = $(res);
var items = xml.find("item");
$.each(items, function(i, v) {
entry = {
title:$(v).find("title").text(),
link:$(v).find("link").text(),
description:$.trim($(v).find("description").text())
};
entries.push(entry);
});
//now draw the list
var s = '';
$.each(entries, function(i, v) {
s += '<li><a href="'+v.link+'">'+v.title+'</a></li>';
});
$("#linksList").html(s);
$("#linksList").listview("refresh");
});
});
//Listen for the content page to load
$("#contentPage").live("pageshow", function(prepage) {
//Set the title
$("h1", this).text(entries[selectedEntry].title);
var contentHTML = "";
contentHTML += entries[selectedEntry].description;
contentHTML += '<p/><a href="'+entries[selectedEntry].link + '">Read Entry on Site</a>';
$("#entryText",this).html(contentHTML);
});
</script>
</head>
<body>
<div data-role="page" id="mainPage">
<div data-role="header">
<h1></h1>
</div>
<div data-role="content">
<div id="status"></div>
<ul id="linksList" data-role="listview" data-inset="true"></ul>
</div>
<div data-role="footer">
<h4>SimpleBlog by Raymond Camden</h4>
</div>
</div>
<div data-role="page" id="contentPage">
<div data-role="header">
<a href="#mainPage" data-rel="back">Home</a>
<h1></h1>
</div>
<div data-role="content" id="entryText">
</div>
</div>
</body>
</html>
答案 0 :(得分:0)
您必须在“ExternalHosts”键下的PhoneGap.plist中添加主机。通配符都可以。因此,如果您要连接到“http://phonegap.com”,则必须将“phonegap.com”添加到列表中(或使用与子域匹配的通配符“* .phonegap.com”)。