這似乎令人難以置信,你不會使用或考慮Parse.com這樣的事情......
(如果不分析,其他一些巴斯具有類似的功能集。)
注 - 解析現在在back4app.com。
1)解析是最簡單的方式做一推iOS應用
2)解析的整體思路是,你有云代碼,這是令人難以置信的簡單,
https://parse.com/docs/cloud_code_guide
您可以擁有云代碼例程,並且可以定期啓用「cron」例程。這就是爲什麼每個人都在使用Parse!
請注意,使用Parse從iOS調用「雲功能」非常容易。
下面是一個例子,
-(void)tableView:(UITableView *)tableView
commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowAtIndexPath:(NSIndexPath *)indexPath
{
int thisRow = indexPath.row;
PFUser *delFriend = [self.theFriends objectAtIndex:thisRow];
NSLog(@"you wish to delete .. %@", [delFriend fullName]);
// note, this cloud call is happily is set and forget
// there's no return either way. life's like that sometimes
[PFCloud callFunctionInBackground:@"clientRequestFriendRemove"
withParameters:@{
@"removeThisFriendId":delFriend.objectId
}
block:^(NSString *serverResult, NSError *error)
{
if (!error)
{
NSLog(@"ok, Return (string) %@", serverResult);
}
}];
[self back]; // that simple
}
通知我打電話雲功能 「clientRequestFriendRemove」。所以,這只是一塊雲代碼我寫的,並且是對我們的解析帳戶,其實這裏是
Parse.Cloud.define("clientRequestHandleInvite", function(request, response)
{
// called from the client, to accept an invite from invitorPerson
var thisUserObj = request.user;
var invitorPersonId = request.params.invitorPersonId;
var theMode = request.params.theMode;
// theMode is likely "accept" or "ignore"
console.log("clientRequestAcceptInvite called.... invitorPersonId " + invitorPersonId + " By user: " + thisUserObj.id);
console.log("clientRequestAcceptInvite called.... theMode is " + theMode);
if (invitorPersonId == undefined || invitorPersonId == "")
{
response.error("Problem in clientRequestAcceptInvite, 'invitorPersonId' missing or blank?");
return;
}
var query = new Parse.Query(Parse.User);
query.get(
invitorPersonId,
{
success: function(theInvitorPersonObject)
{
console.log("clientRequestFriendRemove ... internal I got the userObj ...('no response' mode)");
if (theMode == "accept")
{
createOneNewHaf(thisUserObj, theInvitorPersonObject);
createOneNewHaf(theInvitorPersonObject, thisUserObj);
}
// in both cases "accept" or "ignore", delete the invite in question:
// and on top of that you have to do it both ways
deleteFromInvites(theInvitorPersonObject, thisUserObj);
deleteFromInvites(thisUserObj, theInvitorPersonObject);
// (those further functions exist in the cloud code)
// for now we'll just go with the trick of LETTING THOSE RUN
// so DO NOT this ........... response.success("removal attempt underway");
// it's a huge problem with Parse that (so far, 2014) is poorly handled:
// READ THIS:
// parse.com/questions/can-i-use-a-cloud-code-function-within-another-cloud-code-function
},
error: function(object,error)
{
console.log("clientRequestAcceptInvite ... internal unusual failure: " + error.code + " " + error.message);
response.error("Problem, internal problem?");
return;
}
}
);
}
);
(富勒例子... https://stackoverflow.com/a/24010828/294884)
3)是微不足道的化妝推從解析雲代碼發生,再次這就是爲什麼「每個人都使用它」
例如,下面是涉及到一個推雲解析的代碼片段...
function runAPush(ownerQueryForPush, description)
// literally run a push, given an ownerQuery
// (could be 1 to millions of devices pushed to)
{
var pushQuery = new Parse.Query(Parse.Installation);
pushQuery.matchesQuery('owner', ownerQueryForPush);
Parse.Push.send
(
{
where: pushQuery,
data:
{
swmsg: "reload",
alert: description,
badge: "Increment",
title: "YourClient"
}
},
{
success: function()
{ console.log("did send push w txt message, to all..."); },
error: function(error)
{ console.log("problem! sending the push"); }
}
);
}
4)在nosql環境下,與食物數據庫相關的一切都非常容易。沒有什麼能比的解析方法
5)你得到整個後端免費(用於添加食物,等等)更容易 - 通常個月的工作
6)最後我想分析是相當自由(直到你有這麼多的用戶,你會發財)
所以,我無法想象做你說的任何其他方式 - 這將是一場噩夢,否則。希望它有幫助
只要仔細檢查一下,我就可以從網頁上抓取數據並將其存儲在雲端,只有後端代碼,對吧? – Mahir
是的,我很肯定這是可能的。所以,這裏https://parse.com/docs/cloud_code_guide#networking它解釋瞭如何從互聯網上獲得一些頁面。請注意,你可以寫webhooks,以便「其他服務器可以打電話給你」... https://parse.com/docs/cloud_code_guide#webhooks我建議(a)檢查文檔(b)不要猶豫問一個新的問題,如「我可以做這個解析」,因爲這個網站上有很多解析工程師 – Fattie