Titanium JIRA Archive
Appcelerator Modules (MOD)

[MOD-2407] iOS: apm.setMetadata(key, val) won't work in iOS if val is an integer

GitHub Issuen/a
Resolution Date2018-06-11T20:41:14.000+0000
Affected Version/sn/a
Fix Version/sappcelerator.apm 3.1.2
ReporterMostafizur Rahman
AssigneeHans Knöchel


Hello, While doing some performance testing we came to notice that the setMetadata function seems not to log any integer values to the Appcelerator Dashboard in iOS, but this works fine in Android. However, the Appcelerator documentation says this function takes a String or Integer as its value parameter: https://docs.appcelerator.com/platform/latest/#!/api/Modules.Performance-method-setMetadata The version of the APM we're using is 3.1.0 for both Android and iOS, but all of these tests were executed in simulators/emulators. *Sample app/Test code:* https://propelics.box.com/s/jyzrh9l4gmz3hr1hf6veibtln8dedc4b *Steps to reproduce*: 1) In the sample app open index.js and observe how clicking in the label on the screen should add a username (JohnDoe) and some metadata (two strings and two integers) to the apm. 2) Make sure you modify the tiapp.xml with valid Appcelerator Platform GUID and Keys for the APM module to work. 3) Run the app on iOS. 4) When app launches, click on the "Click me!" label. 5) Look up for the app at http://dashboard.appcelerator.com 6) Look up for the user JohnDoe in the Performance tab, and select that user 7) Observe the metadata values, as only the string values will show there. 8) Additionally, run the application on Android. 9) When the app launches, click on the "Click me!" label. 10) Look up for the app at http://dashboard.appcelerator.com 11) Look up for the user JohnDoe (the one corresponding to Android) in the Performance tab and select it 12) All the metadata values will be there, including the integer ones. Thanks


  1. Hans Knöchel 2018-03-24

    The underlaying Crittercism SDK only supports String values in its native libraries (actually both iOS and Android). Android likely stringifys the values, but iOS errors before. We could stringify it internally, but doing the same on the javaScript side would likely be easier, e.g. apm.setMetadata('Key3', String(10));. In summary, here are the possible options:

    Stringify on the client-side, see above. Also update the docs to state the accepted parameters

    Stringify on the module-side, requires a minor module update

    Reach out to Crittercism to also allow "native" numbers

    Let us know what's preferred!
  2. Hans Knöchel 2018-03-29

    Hey there! We have decided to simply make it work on iOS like it does for Android. Using APM 3.1.1 and later, you will be able to pass either a Number or a String. If a Number is passed, it is stringified to be sent to the Crittercism portal.
  3. Hans Knöchel 2018-03-29

    PR: https://github.com/appcelerator-modules/appcelerator.apm/pull/33 Could be shipped together with the changes from TIMOB-25913 (cc [~gmathews])
  4. Eric Merriman 2018-08-06

    Cleaning up older fixed issues. If this issue should not have been closed as fixed, please reopen.

JSON Source