google analytics在过去的一年里,我一直在努力工作,现在我正在转向swift.我有一个问题导入它使用pods[我做了一个广泛的搜索,它似乎是[use_frameworks!]的问题所需要的Alamofire.
我手动添加了SDK,libGoogleAnalyticsServices.a
并在一个名为的桥接文件中导入了一些其他文件header-Bridging-Header.h:
#import <Google/Analytics.h>
#import <libGoogleAnalyticsServices.a>
#import "GAI.h"
#import "GAIDictionaryBuilder.h"
#import "GAIEcommerceFields.h"
#import "GAIEcommerceProduct.h"
#import "GAIEcommerceProductAction.h"
#import "GAIEcommercePromotion.h"
#import "GAIFields.h"
#import "GAILogger.h"
#import "GAITrackedViewController.h"
#import "GAITracker.h"
Run Code Online (Sandbox Code Playgroud)
现在,AppDelegate.swift我正在尝试从GoogleService-Info.plist配置跟踪器.
var configureError:NSError?
GGLContext.sharedInstance().configureWithError(&configureError)
if configureError != nil {
println("Error configuring the Google context: \(configureError)")
}
Run Code Online (Sandbox Code Playgroud)
但它显示了未解析的标识符GGLContext使用的错误
我正在尝试编写一个获取数字字符串"123188"的方法
然后返回int[]包含数字的内容.
到目前为止我所得到的:
public int[] stringToDig(String a)
{
char [] ch1 = a.toCharArray();
int [] conv = new int [ch1.length];
for (int i=0 ; i<ch1.length ; i++)
conv[i] = Character.getNumericValue(ch1[i]);
return conv;
}
Run Code Online (Sandbox Code Playgroud)
我明白了
此行有多个标记:
- 令牌上的语法错误"(",;预期
- 令牌上的语法错误")",; 预期
- 参数stringToDig的非法修饰符; 只有决赛是允许的
我之前问了一个问题,从那以后我编辑了我的代码,但现在我的代码不会停止,当我读完它不会停止.
public class Done {
public static void main(String[] args){
Scanner kb = new Scanner(System.in);
ArrayList<String> sal = new ArrayList<String>();
int count = 0;
while (true){
sal.add(kb.next());
if (sal.equals("done"))
break;
count++;
}
display(sal);
displayb(sal);
}
public static void display(ArrayList<String> sal){
for (int i=0; i<sal.size(); i++)
System.out.print(sal.get(i)+ " ");
System.out.println();
}
public static void displayb(ArrayList<String> sal){
for (int z = sal.size(); z >= 1; z--)
System.out.print(sal.get(z-1) + " ");
System.out.println();
}
}
Run Code Online (Sandbox Code Playgroud)
当我输入短语"done"时,我的代码不会停止.谁知道我可能做错了什么?
我是javaFx的新手,看了一下源代码,并且有一个关于用于启动应用程序的Application.launch函数的问题.
签名看起来像这样:
public static void launch(Class<? extends Application> appClass, String... args)
Run Code Online (Sandbox Code Playgroud)
我的问题是为什么它看起来不像这样:
public static void launch(Application app, String... args)
Run Code Online (Sandbox Code Playgroud)
作为论证,作者试图通过什么来实现?
我有一个应用程序,用户需要在使用它之前登录。
为了增强用户体验,用户只需要在第一次登录,每次应用程序都不会显示登录屏幕,但会显示应用程序[我使用用户默认值来存储他的ID]现在我已经实现了这一点但我遇到了一个错误,当我成功登录后打开它时,应用程序崩溃了..
问题是: 为了模拟我打开应用程序而不需要登录的场景,我必须停止应用程序[这意味着不会有调试会话],然后重新打开应用程序..
我要问的是: 有没有办法知道我没有在调试会话中运行应用程序来查看导致错误的原因?
提前致谢
我想知道是否有办法在swift中交换两个不同的对象.
这是我的试用期:
func swapXY<T>(inout first: T,intout second: T)
{
(first ,second ) = ( second, first)
}
Run Code Online (Sandbox Code Playgroud)
假设我希望这两个参数分别为T,Y.如何实现这一目标?
谢谢
我正在编写Triangle类的两个构造函数,它们作为参数:String,integer和double数组
private double [] side = new double[3];
public Triangle() {
this("",0,side);
//Here I have a compile error says "Cannot refer to an instance field side while explicitly invoking a constructor"
}
public Triangle(String color, int opacity,double [] side) {
super(color, opacity);
this.side = side ;
}
Run Code Online (Sandbox Code Playgroud)
在主要方法中,我想初始化三角形,但直到现在我才能这样做..
我试过这两种方式,但没有它们起作用
GeoShapes[1] = new Triangle( "Red" , 89 , {2,4,3} ) ;
GeoShapes[2] = new Triangle( "white", 68 , new double{5,6,3} );
Run Code Online (Sandbox Code Playgroud)
注意:我确实尝试初始化一个数组,然后将其引用放在第三个参数中,它可以工作,但这不是我需要的
任何人都可以帮助我在第三个参数中写什么?