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开发者对服务端懂的很少,用它的服务仍是能省不少事的。学习