我想知道如何使用Xcode 4.5上的新框架在iOS 6上向Facebook发布状态消息.谢谢!:)
我是iphone开发的新手.我发布了带有用户名和密码的URL.我能够在"连接didReceiveData"方法中打印数据.但是我看到"连接didReceiveData"方法被调用了两次.我不知道,我哪里出错了.这是我的代码
- (void)viewDidLoad {
[super viewDidLoad];
NSString *post = [NSString stringWithFormat:@"&domain=school.edu&userType=2&referrer=http://apps.school.edu/navigator/index.jsp&username=%@&password=%@",@"xxxxxxx",@"xxxxxx"];
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%d",[postData length]];
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://secure.school.edu/login/process.do"]]];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Current-Type"];
[request setHTTPBody:postData];
NSURLConnection *conn = [[NSURLConnection alloc]initWithRequest:request delegate:self];
if(conn)
{
NSLog(@"Connection Successful");
}
else
{
NSLog(@"Connection could not be made");
}
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData*)data{
NSString *string = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
NSLog(@"the data %@",string);
}
Run Code Online (Sandbox Code Playgroud)
整个HTML页面在控制台中打印两次.所以请帮帮我.谢谢.
我在使用AJAX将数组发布到PHP页面时遇到问题.我一直在用这个问题作为指导,但无论出于何种原因,我仍然无法让它发挥作用.从我可以通过使用告诉我print_r($_POST),我发布一个空数组,但在HTML/Javascript页面上,我使用警报来查看数组已被填充.该帖子正在工作,因为它在帖子上将空白值输入到MySQL数据库中,但我无法弄清楚它为什么传递空数组.代码如下:
使用Javascript:
<script type="text/javascript">
var routeID = "testRoute";
var custID = "testCustID";
var stopnumber = "teststopnumber";
var customer = "testCustomer";
var lat = 10;
var lng = 20;
var timeStamp = "00:00:00";
var dataArray = new Array(7);
dataArray[0]= "routeID:" + routeID;
dataArray[1]= "custID:" + custID;
dataArray[2]= "stopnumber:" + stopnumber;
dataArray[3]= "customer:" + customer;
dataArray[4]= "latitude:" + lat;
dataArray[5]= "longitude:" + lng;
dataArray[6]= "timestamp:" + timeStamp;
var jsonString = JSON.stringify(dataArray);
function postData(){
$.ajax({
type: "POST",
url: "AddtoDatabase.php", …Run Code Online (Sandbox Code Playgroud) 我在Android App中集成了Google Plus.我使用的是Android SDK版本4.2.2.但是我在google plus上执行共享帖时遇到了这个错误:
Google Plus服务已过期
和
ConnectionResult {statusCode = SERVICE_VERSION_UPDATE_REQUIRED,resolution = null}
我想在模拟器上运行Google Plus发布,而不是在设备上运行.
任何帮助将不胜感激.
我正在使用jwordpress-0.4.jar发布到WordPress安装.
我使用的代码是:
Wordpress wp = new Wordpress(username, password, xmlRpcUrl);
Page recentPost = new Page();
recentPost.setPost_status("Published");
recentPost.setDescription("<ul>" + desc + "</ul>");
recentPost.setCategories(cat);
String pageID=recentPost.getPage_id();
String result = wp.newPost(recentPost, true);
Run Code Online (Sandbox Code Playgroud)
这之前运作良好,但现在当我去发布它进入其调度模式时,我尝试过:
recentPost.setPost_status( "发布时间");
和
wp.newPost(recentPost,true);
但这篇文章仍未发表:
我正在尝试使用v2 API开发一个与Tumblr交互的简单应用程序.我能够通过oAuth流程中的每一步(感谢Twitter上的文档)并获得授权和认证的令牌和秘密.但是在发布时,我收到了401未经授权的错误.这是相关的代码段:
private void post_Click(object sender, System.Windows.RoutedEventArgs e)
{
url = new Uri("http://api.tumblr.com/v2/blog/*myblog*.tumblr.com/post");
Random random = new Random();
nonce = random.Next(1234000, 9999999).ToString();
TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
timestamp = Convert.ToInt64(ts.TotalSeconds).ToString();
string method = "POST";
StringBuilder sb = new StringBuilder();
sb.AppendFormat("{0}&", method);
sb.AppendFormat("{0}&", upperCaseUrl(HttpUtility.UrlEncode(url.ToString())));
sb.AppendFormat("body%3D{0}%26", upperCaseUrl(HttpUtility.UrlEncode(textBox.Text)));
sb.AppendFormat("oauth_consumer_key%3D{0}%26", consumerKey);
sb.AppendFormat("oauth_nonce%3D{0}%26", nonce);
sb.AppendFormat("oauth_signature_method%3D{0}%26", "HMAC-SHA1");
sb.AppendFormat("oauth_timestamp%3D{0}%26", timestamp);
sb.AppendFormat("oauth_token%3D{0}%26", token);
sb.AppendFormat("oauth_version%3D{0}%26", "1.0");
sb.AppendFormat("type%3D{0}", "text");
System.Diagnostics.Debug.WriteLine(sb.ToString());
string signingKey = consumerSecret + '&' + secret;
HMACSHA1 signing = new …Run Code Online (Sandbox Code Playgroud) 我在StackOverflow上有类似的帖子,但也许我的误解更为重要.我有一个动作索引()和索引视图的渲染.从Index()视图取决于单击的按钮[HttpPost]索引()或[HttpPost] Search()必须被调用因为我发布了一些数据.发布到不同操作的唯一方法是使用jQuery吗?如果jQuery是唯一的方法,如果我的操作返回视图(完整的Html页面),我必须从$ .post清理整个文档元素并用我的视图html填充它?我对这一切都很陌生,非常感谢!
@using (Html.BeginForm())
{
<input name="startDate" type="text" size="20" class="inputfield" id="datepicker" />
<a href="#" id="apply_button">...</a>
<a href="#" id="go_button">...</a>
}
public ActionResult Index(string lang)
{
return View();
}
//Perhaps this action is needed
[HttpPost]
public ActionResult Index(string lang, string startDate)
{
return View();
}
[HttpPost]
public ActionResult Search(string lang, string startDate)
{
return View();
]
Run Code Online (Sandbox Code Playgroud) 我正在开发一个facebook应用程序.我在打开的图表中创建了一个自定义对象,下面列出的是我的一些顾虑
FB.api('/ me/myapp:myaction'+'?myobject = myobjecturl&access_token = myaccessToken','post',{scrape:true},
function (response) {
var msg = 'Error occured';
if (!response || response.error) {
if (response.error) {
msg += "\n\nType: " + response.error.type + "\n\nMessage: " + response.error.message;
} alert(msg);
} else {
alert('Post was successful! Action ID: ' + response.id);
}
});
Run Code Online (Sandbox Code Playgroud)
应该与对象中元标记中的og:url相同?
我们可以传递任何查询字符串以及可以在对象页面中检索的对象URL吗?
我们如何发布具有不同对象属性的相同对象类型(例如,不同的图像,不同的URL等)
任何帮助是极大的赞赏.
所以我试图从以后将被发送到数据库的3个复选框中获取值,但由于某些原因,在进行测试时它们不会在PHP中发布.
<table width="200" border="0">
<tr>
<td><img src="images/image1.jpg" ></td>
<td><img src="images/image2.jpg" ></td>
<td><img src="images/image3.jpg" ></td>
</tr>
<tr>
<td><input type="checkbox" id="checkbox65" class="css-checkbox med" name="avatar" value="image1"/>
<label for="checkbox65" class="css-label med elegant" /></label></td>
<td><input type="checkbox" id="checkbox66" class="css-checkbox med" name="avatar" value="image2"/>
<label for="checkbox66" class="css-label med elegant" /></label></td>
<td><input type="checkbox" id="checkbox67" class="css-checkbox med" name="avatar" value="image3"/>
<label for="checkbox67" class="css-label med elegant" ></label></td>
</tr>
</table><br>
Run Code Online (Sandbox Code Playgroud)
我在另一页面发帖:
<?php
if(isset($_POST['submit'])){$avatar=$_POST['avatar'];}
echo $avatar; ?>
Run Code Online (Sandbox Code Playgroud)
但我得到了
Undefined index: avatar on line 14
Run Code Online (Sandbox Code Playgroud)
我有表格标签,一切都是正确的,这是一个不同的问题,页面上的其他所有内容都正确发布,除了这一件事
我成功发布到Facebook墙,但我希望用户可以选择是否要将其发布到某些特定的朋友列表,例如熟人,家庭等
我的代码给出了这个错误:
{"error":{"message":"(#100) privacy must contains a valid privacy 'value'","type":"OAuthException"}}
Run Code Online (Sandbox Code Playgroud)
我添加了"隐私"属性并赋予它"家庭"的价值,但它不起作用,但是如果我删除了隐私属性,那么墙贴就成功了
try
{
Bundle parameters = new Bundle();
parameters.putString("message", msg);
parameters.putString("description", "Test 1");
JSONObject jsonObject = new JSONObject();
jsonObject.put("value", "Family");
parameters.putString("privacy", jsonObject.toString());
response = Data.facebook.request("me/feed", parameters,"POST");
} catch(Exception e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud) 我有一堆动态标签(div),例如:
<div id="collection">
<div id="tab-1">
<ul id="sortable-tab-1">
<li>
</li>
</ul>
</div>
<div id="tab-2" class="hidden">
<ul id="sortable-tab-2">
<li>
</li>
</ul>
</div>
.... etc ...
</div>
Run Code Online (Sandbox Code Playgroud)
我正在寻找最好的方法来找出使用jquery可见的哪个标签(div).由于标签是动态的,我不知道id,但我知道哪个div是隐藏的,因此留下一个可见的div.
我需要以某种方式找到UL ID可见的div然后返回UL标识.所以我留下了'sortable-tab-1'作为我的结果.
基本上我需要知道选择了哪个选项卡,这样我就可以发布正确的可排序列表.
JavaScript给了我一个头痛!
谁能帮忙.谢谢.