小编Nok*_*ner的帖子

iOS - 自动续订订阅到期

问题 1:

我已经阅读了有关订阅的 Apple 文档,但我仍然不确定是否可以从收据中获取自动续订订阅的到期日期,而无需联系 iOS 9 的 Apple 服务器?这有意义吗?

问题2

目前我正在做的是让自动续订订阅到期:

  • 使用 [[NSBundle mainBundle] appStoreReceiptURL] 并继续将收据转换为 base 64 字符串

  • 创建一个字典,其中包含此收据数据和共享机密

  • 将此字典转换为 JSON 字符串

  • 将此 JSON 字符串发送到https://sandbox.itunes.apple.com/verifyReceipt

  • 返回从应用商店作为回复收到的 JSONized 收据字典

  • 从 latest_receipt_info 字典中的 expires_date_ms 中获取到期日期

我不完全确定这是否正确,因为根据文档,不可能在 App Store 和设备之间实现安全链接(我目前正在这样做)。事实上,文档指出我需要自己的服务器来为我与 App Store 通信(https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html#/ /apple_ref/doc/uid/TP40010573-CH104-SW1)。

这是可以接受的方法还是我需要自己的服务器?如果我需要我自己的服务器,有人可以指导我如何设置它的正确方向吗?

注意:每当使用 OpenSSL 使用本地验证进行购买时,我都会对非消耗性和消耗性应用内购买执行收据验证。所以应该没问题。

提前致谢。

json date subscriptions ios

5
推荐指数
1
解决办法
672
查看次数

当 Fragment 被替换并再次可见时回调

我一直在研究这个话题,但到目前为止没有运气。基本上,我正在使用FragmentTransaction.replace. 在另一个片段 (B) 中,我在工具栏中有一个“取消”按钮,按下该按钮会通过调用getActivity().getSupportFragmentManager().popBackStackImmediate().

问题是当我显示片段 A 和片段 B 时,我需要更新“活动”工具栏以显示不同的标题。我似乎无法找到在片段 A 中调用的方法,无论何时我从 A -> B - > A 通知我它再次可见。这个想法是在这个回调中设置我似乎找不到的工具栏标题。

任何人都可以指出我正确的方向吗?

干杯。

编辑:

我调用的用另一个片段替换片段的方法如下:

public static void replaceFragment(FragmentActivity parentActivity, int fragmentToReplaceId, Fragment withFragment, Integer enterAnim, Integer exitAnim)
{
    FragmentManager         fragmentManager;
    FragmentTransaction     transaction;

    fragmentManager = parentActivity.getSupportFragmentManager();
    transaction     = fragmentManager.beginTransaction();

    if (    (null != enterAnim) &&
            (null != exitAnim)  )
    {
        transaction.setCustomAnimations(enterAnim, exitAnim);
    }

    transaction.replace(fragmentToReplaceId, withFragment);
    transaction.addToBackStack(null);
    transaction.commit();
}
Run Code Online (Sandbox Code Playgroud)

android android-fragments

5
推荐指数
1
解决办法
5373
查看次数

标签 统计

android ×1

android-fragments ×1

date ×1

ios ×1

json ×1

subscriptions ×1