小编Reg*_*_AG的帖子

Android/Google AnalyticsSDK:如何使REAL TIME分析工作?

我在我的应用中安装了Google AnalyticsSDK.

我希望能够进行实时分析(Google提出的新功能).

我的代码:

tracker = GoogleAnalyticsTracker.getInstance();
// the tracker is started with a dispatch interval of 20 seconds.
tracker.startNewSession("UA-XXXXX", 20, theContext);
tracker.trackEvent("Init", theContext.getPackageName(),"NoLabel", 0);
tracker.dispatch();
Run Code Online (Sandbox Code Playgroud)

我可以关注"Init"事件,但是实时统计数据(例如,使用我的应用程序的实际用户数量)不起作用,即使我已经使用可以在调度时启动我的跟踪器,而不是这样:

tracker.startNewSession("UA-XXXX", theContext);
Run Code Online (Sandbox Code Playgroud)

你知道如何解决这个问题吗?

谢谢 !!

sdk android analytics google-analytics real-time

1
推荐指数
1
解决办法
1933
查看次数

Xcode:Localizable.strings:字符串转换失败.该字符串为空.copystrings失败,退出代码为1

我使用Localizable.strings文件并用NSLocalizedString(@"KEY",@"COMMENT")替换我的应用程序中的字符串.

我现在更换了很多字符串,效果很好.我添加了一些字符串,现在我收到以下错误消息:

CopyStringsFile build/Debug-iphoneos/Australia.app/en.lproj/Localizable.strings en.lproj/Localizable.strings cd/Users/regisandre/Desktop/XCode/AUSTRALIAENINT setenv ICONV/usr/bin/iconv setenv PATH"/ Developer /平台/ iPhoneOS.platform/Developer/usr/bin:/ Developer/usr/bin:/ usr/bin:/ bin:/ usr/sbin:/ sbin"/Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/目录/资源/ copystrings --validate --inputencoding utf-8 --outputencoding binary en.lproj/Localizable.strings --outdir /Users/regisandre/Desktop/XCode/AUSTRALIAENINT/build/Debug-iphoneos/Australia.app/en .lproj en.lproj/Localizable.strings:字符串转换失败.该字符串为空.en.lproj/Localizable.strings:字符串转换失败.该字符串为空.Command/Developer/Library/Xcode/Plug-ins/CoreBuildTasks.

更新:

你是对的 !这是UTF-8/UTF-16编码的问题.一旦使用genstrings生成文件,就必须避免从其他文件(甚至是Xcode)中复制/粘贴字符串文件,因为它会引起一些编码问题.

一旦使用Xcode生成文件,所有修改都必须通过"直接键入keayboard"直接在文件中完成; 没有复制/粘贴!(除非你确定你复制/粘贴的格式是正确的,但似乎不太容易知道)

localization internationalization localizable.strings nslocalizedstring

0
推荐指数
1
解决办法
3199
查看次数

Android 通知:使用多个 setOnClickPendingIntent 时的错误

我有一个奇怪的错误。

我收到了一个带有 3 个按钮(后退、下一步、播放/暂停)的通知。我想在启动服务的这三个按钮中的每一个上设置不同的 pendingIntent。这是我的代码:

    Intent playPauseIntent = new Intent(MyApp.mainActivity, NotificationService.class);
    playPauseIntent.putExtra("do_action", "play");
    contentView.setOnClickPendingIntent(R.id.notifPlayPauseImageView, PendingIntent.getService(MyApp.mainActivity, 0, playPauseIntent, PendingIntent.FLAG_UPDATE_CURRENT));            

    Intent nextRadioIntent = new Intent(MyApp.mainActivity, NotificationService.class);
    nextRadioIntent.putExtra("do_action", "next");
    contentView.setOnClickPendingIntent(R.id.notifNextImageView, PendingIntent.getService(MyApp.mainActivity, 0, nextRadioIntent, PendingIntent.FLAG_UPDATE_CURRENT));

    Intent previousRadioIntent = new Intent(MyApp.mainActivity, NotificationService.class);
    previousRadioIntent.putExtra("do_action", "previous");
    contentView.setOnClickPendingIntent(R.id.notifPreviousImageView, PendingIntent.getService(MyApp.mainActivity, 0, previousRadioIntent, PendingIntent.FLAG_UPDATE_CURRENT));

    notification.contentView = contentView;
    mNotificationManager.notify(1, notification); 
Run Code Online (Sandbox Code Playgroud)

然后,在我的服务中,我将“do_action”的意图和值定义为额外的:

@Override
public int onStartCommand(Intent intent,  int flags, int startId) { 

   if(intent != null && intent.getExtras() != null)
   {
      String action = (String) intent.getExtras().get("do_action"); // BUG HERE ! I always get …
Run Code Online (Sandbox Code Playgroud)

java android android-intent android-notifications android-pendingintent

0
推荐指数
1
解决办法
213
查看次数

目标 C 中的“DispatchQueue.main.async { [weak self] in”?

Swift 代码的等价物是什么:

DispatchQueue.main.async { [weak self] in
        self?.detectObjects()
    }
Run Code Online (Sandbox Code Playgroud)

在目标 C 中?

谢谢。

objective-c swift

0
推荐指数
1
解决办法
5307
查看次数