Highlighted

Get data from application descriptor file at runtime

Community Beginner ,
Jul 22, 2014

Copy link to clipboard

Copied

Hi there,

For some reason I have to read some data out of the application descriptor file at runtime. Precisely, I am interested in the UIDeviceFamily tag which indicates whether the app is iPhone / iPod only or if runs on iPad too :

<key>UIDeviceFamily</key>

<array>

<string>1</string>

</array>

I can access the <InfoAdditions> node which is the parent, but I can't go deeper :

var appDescriptor:XML = NativeApplication.nativeApplication.applicationDescriptor;

var ns:Namespace = appDescriptor.namespace();

var iPhone:XML = new XML( appDescriptor.ns::iPhone );


var data:XML = new XML( iPhone.child(0) );


I think that's because the XML is not formatted correctly for the AS3 parser. I tried to use RegEx but I am not that good with those things 😞


var reg:RegExp = /.*?<key>UIDeviceFamily<\/key><array>(.*?)<\/array><key>UIPrerenderedIcon<\/key>/gi;

var s2:String = reg.exec( s1 )[1];

Any advice on this would be welcome !


TOPICS
Development

Views

87

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Get data from application descriptor file at runtime

Community Beginner ,
Jul 22, 2014

Copy link to clipboard

Copied

Hi there,

For some reason I have to read some data out of the application descriptor file at runtime. Precisely, I am interested in the UIDeviceFamily tag which indicates whether the app is iPhone / iPod only or if runs on iPad too :

<key>UIDeviceFamily</key>

<array>

<string>1</string>

</array>

I can access the <InfoAdditions> node which is the parent, but I can't go deeper :

var appDescriptor:XML = NativeApplication.nativeApplication.applicationDescriptor;

var ns:Namespace = appDescriptor.namespace();

var iPhone:XML = new XML( appDescriptor.ns::iPhone );


var data:XML = new XML( iPhone.child(0) );


I think that's because the XML is not formatted correctly for the AS3 parser. I tried to use RegEx but I am not that good with those things 😞


var reg:RegExp = /.*?<key>UIDeviceFamily<\/key><array>(.*?)<\/array><key>UIPrerenderedIcon<\/key>/gi;

var s2:String = reg.exec( s1 )[1];

Any advice on this would be welcome !


TOPICS
Development

Views

88

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jul 22, 2014 0

Have something to add?

Join the conversation