我无法在android studio上设置firebase的更新版本.我已经在站点firebase上创建了项目的json文件,并将其复制到项目中并在gradle中处理行后:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.0.0'
}
}
apply plugin: 'com.android.application'
android {
// ...
}
dependencies {
compile 'com.google.firebase:firebase-core:9.0.1'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
failed to resolve: compile 'com.google.firebase:firebase-core:9.0.0'
我该如何解决?
var myCountry:String?
var myCity:String?
var myBodyType:String?
var myOrientation:String?
var myRelationship:String?
Run Code Online (Sandbox Code Playgroud)
我需要从这个数据构建一个字典变量,但myCountry和myCity我想在一个键"region"下组合.我试过:
var myData = ["region":["country":myCountry,"city":myCity],"bodyType":myBodyType,"orientation":myOrientation,"relationship":myRelationship]
Run Code Online (Sandbox Code Playgroud)
这是不对的.这该怎么做?
我有带有 getContentInBackgroundWithMemberId 和 postRequest 函数的 RequestManager 类。我想从我的视图控制器调用它们并使用完成处理程序获取结果。如何编辑我的函数?
请求管理器
#import <Foundation/Foundation.h>
@interface RequestManager : NSObject
-(void)getContentInBackgroundWithMemberId:(int)memberId;
@end
Run Code Online (Sandbox Code Playgroud)
请求管理器
#import "RequestManager.h"
@implementation RequestManager
-(void)postRequestWithParams:(NSDictionary*)params
{
NSString *parameters = @"encrypt=93mrLIMApU1lNM619WzZje4S9EeI4L2L";
for(id key in params)
{
NSString *obj = [NSString stringWithFormat:@"&%@=%@",key,[params objectForKey:key]];
[parameters stringByAppendingString:obj];
}
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:@"http://someserver"]];
NSData *postBody = [parameters dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:postBody];
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse * _Nullable response, NSData * _Nullable data, NSError * _Nullable connectionError) {
if(!connectionError)
{
NSDictionary …Run Code Online (Sandbox Code Playgroud) 如果用户关闭应用程序,我可以包含运行一次的函数吗?如果是这样,我应该把那个函数放在哪里,因为我不知道用户将从哪个视图控制器关闭应用程序。解决办法是什么?