appstore应用内支付ANE,在flash air开发的ios应用中添加应用内支付功能,InAppPurchases 支持IOS平台

最近项目用到flash air for IOS去调用IOS内购,与IOS同事(好基友)交互,调整了下,出了个ANE,如果有需要的开发同学,可以下载测试版本玩一玩,需要去掉版权弹框的可以联系我,当然用的可以给个打赏最好啦,下面内购是可以使用,但是如果商业用途,下发物品最好还是服务端验证以后在发,因为越狱机有破解内购的插件。

用到的是目前最新AIRSDK33.1

如果有其他问题可以联系我,大家交流,IOS方面我可以找我好基友。哈哈哈。

iosneigou.zip

下面是ActionScript 3.0 demo

package
{
    import com.freshplanet.ane.AirInAppPurchase.InAppPurchase;
    import com.freshplanet.ane.AirInAppPurchase.InAppPurchaseEvent;
    
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.text.TextField;
    import flash.text.TextFormat;
    
    public class neigouTest extends Sprite
    {
        private var txtform:TextFormat;
        private var ane:InAppPurchase = InAppPurchase.instance;
        private var productIds:String="com.com.100";//内购产品ID
        
        public function neigouTest()
        {
            super();
            ane.init(productIds,true);
            kaishi();
            stage.color = 0xFA8072;            
        }
        
        public function kaishi():*{
            txtform=new TextFormat();
            txtform.size=35;
            txtform.align="center"
            var numTxt:TextField= new TextField();
            numTxt.textColor=0xFF1493;        
            numTxt.width=stage.stageWidth;
            numTxt.y=stage.stageHeight/2-30;
            numTxt.height=45;
            numTxt.defaultTextFormat=txtform;
            numTxt.background=true;
            numTxt.backgroundColor=0xFA8072;
            numTxt.border=true;
            numTxt.borderColor=0xFFFFFF;
            numTxt.selectable=false;
            numTxt.text = '调取内购';
            numTxt.addEventListener(MouseEvent.CLICK,getStart);
            addChild(numTxt);
        }
        
        private function getStart(event:Event):void
        {
            trace('调用内购方法');
            ane.makePurchase(productIds);
            ane.addEventListener(InAppPurchaseEvent.PURCHASE_SUCCESSFUL,suucess); //监听成功调用
            ane.addEventListener(InAppPurchaseEvent.PURCHASE_ERROR,faild); //监听失败调用
        }
        
        public function suucess(e:InAppPurchaseEvent):void
        {            
            ane.removePurchaseFromQueue(productIds, null);
            trace('购买成功');
        }
        
        public function faild(e:InAppPurchaseEvent):void
        {            
            ane.removePurchaseFromQueue(productIds, null);
            trace('购买失败');
        }
    }
}

最后修改:2020 年 06 月 06 日
如果觉得我的文章对你有用,请随意赞赏