AVSO Cloud是解決雲端數據存儲,消息推送,用戶行爲統計分析和社會化組件以及後端部署的一站化提供商,支持iOS、安卓、JavaScript平臺,支持cocoapods安裝。html
由於是一站式服務,AVOS Cloud比其餘的平臺有很多優點。git
第二章、快速使用後端
AVOS Cloud的集成很方便,官方的介紹請看這裏。app
如下是iOS端的代碼:ide
1 AVObject *gameScore = [AVObject objectWithClassName:@"GameScore"]; 2 [gameScore setObject:[NSNumber numberWithInt:1337] forKey:@"score"]; 3 [gameScore setObject:@"Steve" forKey:@"playerName"]; 4 [gameScore setObject:[NSNumber numberWithBool:NO] forKey:@"cheatMode"]; 5 [gameScore save];
1 // Send a notification to all devices subscribed to the "Giants" channel. 2 AVPush *push = [[AVPush alloc] init]; 3 [push setChannel:@"Giants"]; 4 [push setMessage:@"The Giants just scored!"]; 5 [push sendPushInBackground];
1 - (void)viewWillAppear:(BOOL)animated 2 { 3 [super viewWillAppear:animated]; 4 [AVAnalytics beginLogPageView:@"PageOne"]; 5 } 6 7 8 - (void)viewWillDisappear:(BOOL)animated { 9 [super viewWillDisappear:animated]; 10 [AVAnalytics endLogPageView:@"PageOne"]; 11 }
1 [AVOSCloudSNS setupPlatform:AVOSCloudSNSSinaWeibo withAppKey:@"Weibo APP ID" andAppSecret:@"Weibo APP KEY" andRedirectURI:nil]; 2 3 [AVOSCloudSNS loginWithCallback:^(id object, NSError *error) { 4 // Your code here 5 } toPlatform:AVOSCloudSNSSinaWeibo];
SVOS Cloud提供的服務使用起來明顯要比其餘的平臺要好不少,對於像我這樣的iOS開發者對服務端懂的很少,用它的服務仍是能省不少事的。學習