diff --git a/actionscript/src/com/freshplanet/ane/AirInAppPurchase/InAppPurchase.as b/actionscript/src/com/freshplanet/ane/AirInAppPurchase/InAppPurchase.as index ae68b43..5654680 100644 --- a/actionscript/src/com/freshplanet/ane/AirInAppPurchase/InAppPurchase.as +++ b/actionscript/src/com/freshplanet/ane/AirInAppPurchase/InAppPurchase.as @@ -138,7 +138,11 @@ package com.freshplanet.ane.AirInAppPurchase { productsIds ||= []; subscriptionIds ||= []; - _context.call("getProductsInfo", productsIds, subscriptionIds); + if (!_allStrings(productsIds) || !_allStrings(subscriptionIds)) { + _dispatchEvent(InAppPurchaseEvent.PRODUCT_INFO_ERROR, "Product and subscription IDs must all be strings"); + } else { + _context.call("getProductsInfo", productsIds, subscriptionIds); + } } } @@ -214,6 +218,17 @@ package com.freshplanet.ane.AirInAppPurchase { _dispatchEvent(event.code, event.level); } + /** Return true if all values in the array are strings */ + private static function _allStrings(arr:Array):Boolean { + + for each (var obj:Object in arr) { + if (!(obj is String)) { + return false; + } + } + return true; + } + /** * * @param strings