zwetan / as3-universal-analytics

Google Universal Analytics for AS3
Mozilla Public License 2.0
73 stars 11 forks source link

IOS Black Screen: Launch Failed #34

Open TobyKaos opened 6 years ago

TobyKaos commented 6 years ago

I have added uanalytics 0.8.0 for Air.

On launch of my app I create the Configuration and the tracker. All is ok on Android (Air27) and flash(Air28) versions. But on IOS(Air27) the app does not start.

Note: I used Starling V1.8. FlashDevelop 5.3.

zwetan commented 6 years ago

Like that it's hard to see what's happening, I doubt including the uanalytics lib would prevent an app to start

on iOS did you try to remove all reference of the lib uanalytics? and if so, then does the app start?

on iOS you are supposed to only connect to HTTPS URL so when you are including the lib uanalytics do you configure it to use SSL?

eg.

var config:Configuration = new Configuration();
    config.forceSSL = true;
TobyKaos commented 6 years ago

Then I only remove start code and it works. And no I have not use forceSSL. I will try this and I think you are right about this. I will tell you asap, thank you.

zwetan commented 6 years ago

if you absolutely need to not use HTTPS you should be able to edit your AIR app xml iOS Settings

and add the key

<key>NSAppTransportSecurity</key>  
<dict>  
  <key>NSAllowsArbitraryLoads</key>  
  <true/>  
<dict>

that said, I would advise to always use HTTPS

TobyKaos commented 6 years ago

arf, no. It is not better. I have no crash logs and do not know how to active it (Starling framework)

zwetan commented 6 years ago

ok then, could you show me how you initialise all that in code?

TobyKaos commented 6 years ago

in an initialize function, called by the constructor of the Document Class of the app:

config = new Configuration();
config.anonymizeIp = true;
config.forceSSL = true;

mTracker = new AppTracker(viewID, config);

var appinfo:ApplicationInfo = generateAIRAppInfo();

mTracker.add( appinfo.toDictionary() );

this works well on Android

zwetan commented 6 years ago

ok so basic check

in your main class, does those properties config and mTracker are declared as static variables ?

TobyKaos commented 6 years ago
private var mTracker:AppTracker = null;
private var config:Configuration = null;
TobyKaos commented 6 years ago

Then I obtains this error in remote debug: [Fault] exception, information=TypeError: Error #1080: Illegal value for namespace

zwetan commented 6 years ago

ok so try to do something like that instead

eg.

package com.foobar.blah
{
    public class Main
    {
        public static var tracker: AppTracker;

        public function Main()
        {
            // ...
        }

        public function onStartStuff()
        {
            // ...
            tracker = new AppTracker(viewID, config);
            // ...
        }

    }
}

and so later in other part of the app you can still reference the tracker eg. Main.tracker.doSomethign()

zwetan commented 6 years ago

humm #1080: Illegal value for namespace maybe there is a bug with generateAIRAppInfo()

try to not use it and initialise by hand eg.

var gameinfo:Dictionnary = new Dictionnary();
    gameinfo[ Tracker.APP_NAME ] = "My Game";
    gameinfo[ Tracker.APP_ID ] = "com.something.mygame";
    gameinfo[ Tracker.APP_VERSION ] = "1.0.0";
    gameinfo[ Tracker.APP_INSTALLER_ID ] = "Amazon App Store";

tracker.add( gameinfo );
TobyKaos commented 6 years ago

Yes stack is in generateAIRAppInfo(). I will try without

zwetan commented 6 years ago

I would be interested in the error stack trace if possible (you can send it privately by email if you prefer), so I can fix that bug for later

in your AIR app descriptor do you use multiple languages?

eg.

<name> 
    <text xml:lang="en">Sample 1.0</text> 
    <text xml:lang="fr">Échantillon 1.0</text> 
    <text xml:lang="de">Stichprobe 1.0</text> 
</name>
TobyKaos commented 6 years ago

This work without generateAIRIngo: error is here: global/libraries.uanalytics.utils::generateAIRAppInfo at /Volumes/prototype/libraries/as3-universal-analytics/src/libraries/uanalytics/utils/generateAIRAppInfo.as:105

zwetan commented 6 years ago

yeah there is a bug

generateAIRAppInfo.as:105 is

app_name = descriptor.name.text.(@xml::lang == lang);

and before

// first we use the default system language
var lang:String = Capabilities.language;

but after thinking of it the default language on the phone is not necessarily the default language we want to define in the app, etc.

TobyKaos commented 6 years ago

maybe on iPad air 2 ios 11 the namespace is not http://www.w3.org/XML/1998/namespace

I am not an expert on actionscript and XML

zwetan commented 6 years ago

I'm pretty sure it is an issue between the Capabilities.language and the AIR descriptor

either simple

<name>Sample Something</name> 

or complex

<name> 
    <text xml:lang="en">Sample 1.0</text> 
    <text xml:lang="fr">Échantillon 1.0</text> 
    <text xml:lang="de">Stichprobe 1.0</text> 
</name>

if you could tell me wether your app descriptor is simple or complex, it could help

TobyKaos commented 6 years ago

Yes it is complex.

<name>
    <text aaa:lang="fr" xmlns:aaa="http://www.w3.org/XML/1998/namespace">Glucozor test</text>
    <text aaa:lang="en" xmlns:aaa="http://www.w3.org/XML/1998/namespace">Glucozor test</text>
    <text aaa:lang="de" xmlns:aaa="http://www.w3.org/XML/1998/namespace">Glucozor test</text>
    <text aaa:lang="es" xmlns:aaa="http://www.w3.org/XML/1998/namespace">Glucozor test</text>
    <text aaa:lang="it" xmlns:aaa="http://www.w3.org/XML/1998/namespace">Glucozor test</text>
    <text aaa:lang="zh" xmlns:aaa="http://www.w3.org/XML/1998/namespace">Glucozor test</text>
  </name>
zwetan commented 6 years ago

is that the output from debug stacktrace or is it how you defined the AIR descriptor XML?

TobyKaos commented 6 years ago

` var na:NativeApplication = NativeApplication.nativeApplication; var desc:XML = na.applicationDescriptor;

trace(desc.toXMLString()); `

I defined multi app name in my application.xml file

zwetan commented 6 years ago

ok thanks for the information and the bug report

llorenzo commented 4 years ago

Hi, since starling flox will shut down this year, I will need something to analyse my app. Is this bug still happening. My XML also uses different names as per language.