是否有快速替代已弃用的“SKPaymentTransaction.transactionReceipt”?

     2023-03-16     226

关键词:

【中文标题】是否有快速替代已弃用的“SKPaymentTransaction.transactionReceipt”?【英文标题】:Is there a fast replacement for deprecate `SKPaymentTransaction.transactionReceipt`? 【发布时间】:2014-05-15 13:41:45 【问题描述】:

是否有快速替代已弃用的 SKPaymentTransaction.transactionReceipt?

完整代码:

// saves a record of the transaction by storing the receipt to disk
- (void)recordTransaction:(SKPaymentTransaction *)transaction 
    if ([transaction.payment.productIdentifier isEqualToString:[self getProductId:gFullVersion]]) 
        // save the transaction receipt to disk
        [[NSUserDefaults standardUserDefaults] setValue:transaction.transactionReceipt forKey:[self getProductId:gFullVersion]];
        [[NSUserDefaults standardUserDefaults] synchronize];
    

【问题讨论】:

【参考方案1】:

正确答案应该是:

[NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]]

以及完整的代码:

// saves a record of the transaction by storing the receipt to disk
- (void)recordTransaction:(SKPaymentTransaction *)transaction 
    if ([transaction.payment.productIdentifier isEqualToString:[self getProductId:gFullVersion]]) 
        // save the transaction receipt to disk
        [[NSUserDefaults standardUserDefaults] setValue:[NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]] forKey:[self getProductId:gFullVersion]];
        [[NSUserDefaults standardUserDefaults] synchronize];
    

【讨论】:

@MaciejSwic 如何在不使用已弃用的 transactionReceipt 属性的情况下验证单个交易的收据? @user1681701 所有收据都在捆绑包中,iirc 你得到一个数组或字典,循环遍历它,你也会在其中找到所有 IAP 收据。 否决,此代码 sn-p 不能完全替代检索与单个交易相关的收据信息。 也被否决了。根本不回答问题。

替代已弃用的 AudioManager.isWiredHeadsetOn?

...anager.isWiredHeadsetOn()从api级别14被弃用,我们现在如何检测是否连接了有线耳机?【问题讨论】:【参考方案1】:这是我的解决方案:p 查看详情

pymxs 替代已弃用的 MaxPlus 实用程序函数

...除MaxPlus,我现在不得不重新编写一些代码,并且想知道是否有其他方法可以访问某些MaxPlus实用程序功能。虽然我认为将python开发整合到pymxs下的决定 查看详情

BitmapDrawable 已弃用的替代方案

】BitmapDrawable已弃用的替代方案【英文标题】:BitmapDrawabledeprecatedalternative【发布时间】:2012-04-1606:11:56【问题描述】:我有以下代码可以将可绘制对象旋转一定的度数。publicDrawablerotateDrawable(floatangle,Contextcontext)BitmaparrowBitmap=Bitm... 查看详情

寻找现在已弃用的 retryWhen 的替代方案

】寻找现在已弃用的retryWhen的替代方案【英文标题】:LookingforanalternativeofretryWhenwhichisnowDeprecated【发布时间】:2020-10-0616:34:43【问题描述】:我遇到了WebClient和reactor-extra的问题。确实,我有以下方法:publicEmployeegetEmployee(Stringemp... 查看详情

已弃用的 AudioManger.setStreamMute 的替代方案?

】已弃用的AudioManger.setStreamMute的替代方案?【英文标题】:AlternativefordeprecatedAudioManger.setStreamMute?【发布时间】:2016-01-0812:48:11【问题描述】:AudioManger.setStreamMute现在被api23弃用,最好使用AudioManager.adjustStreamVolume和AudioManager.ADJU... 查看详情

图像中已弃用的 Notification 类的替代方法是啥?

】图像中已弃用的Notification类的替代方法是啥?【英文标题】:WhatisthealternativeforthedeprecatedNotificationclassintheimage?图像中已弃用的Notification类的替代方法是什么?【发布时间】:2014-02-1811:14:20【问题描述】:我打算在android设备的... 查看详情

已弃用的 google plus api 的替代解决方案是啥?

】已弃用的googleplusapi的替代解决方案是啥?【英文标题】:Whatisthealternativesolutionofdeprecatedgoogleplusapi?已弃用的googleplusapi的替代解决方案是什么?【发布时间】:2019-06-2315:43:08【问题描述】:Google宣布在3月7日弃用所有googleplusapi... 查看详情

iOS 12.0 替代使用已弃用的 archiveRootObject:toFile:

】iOS12.0替代使用已弃用的archiveRootObject:toFile:【英文标题】:iOS12.0AlternativetoUsingDeprecatedarchiveRootObject:toFile:【发布时间】:2019-05-0322:47:12【问题描述】:在iOS12中,archiveRootObject:toFile:已被弃用。任何人都可以提出一种简化的替代... 查看详情

已弃用的 Hibernate.createClob(Reader reader, int length) 的替代方法是啥

】已弃用的Hibernate.createClob(Readerreader,intlength)的替代方法是啥【英文标题】:WhatisthealternatefordeprecatedHibernate.createClob(Readerreader,intlength)已弃用的Hibernate.createClob(Readerreader,intlength)的替代方法是什么【发布时间】:2012-02-1601:23:11【 查看详情

如何为已弃用的英特尔 IPP API 找到替代 API?

】如何为已弃用的英特尔IPPAPI找到替代API?【英文标题】:HowtofindalternativeAPIsfordeprecatedIntelIPPAPIs?【发布时间】:2014-11-0410:11:49【问题描述】:我正在与IntelIntegratedPerformancePrimitives(IntelIPP8.2)合作。我正在尝试使用来自UtilityFunction... 查看详情

Android:替代已弃用的 Context.MODE_WORLD_READABLE?

】Android:替代已弃用的Context.MODE_WORLD_READABLE?【英文标题】:Android:AlternativetothedeprecatedContext.MODE_WORLD_READABLE?【发布时间】:2012-12-0103:51:09【问题描述】:Fromhere我知道一种写入文件并可供其他应用程序和其他意图访问的方法,... 查看详情

[FFmpeg]啥是已弃用的 avpicture_alloc、avpicture::data 的替代品

】[FFmpeg]啥是已弃用的avpicture_alloc、avpicture::data的替代品【英文标题】:[FFmpeg]whatisreplacementsofavpicture_alloc,avpicture::datawhichweredeprecated[FFmpeg]什么是已弃用的avpicture_alloc、avpicture::data的替代品【发布时间】:2016-04-1204:47:35【问题描... 查看详情

channel 或 mutablesharedflow ,哪个是已弃用的 localbroadcastmanager 的更好替代品

...l或mutablesharedflow,哪个是已弃用的localbroadcastmanager的更好替代品【英文标题】:channelormutablesharedflow,whichoneisabetterreplacementfordeprecatedlocalbroadcastmanager【发布时间】:2021-04-0321:15:20【问题描述】:过去,我在聊天和出租车应用程序... 查看详情

Google Sceneform – 是不是已弃用?有替代品吗? [关闭]

...GoogleSceneform–Isitdeprecated?Anyreplacement?[closed]GoogleSceneform–是否已弃用?有替代品吗?[关闭]【发布时间】:2020-10-0817:05:43【问题描述】:我在我的ARCore项目Sceneform中使用。看来这个项目现在被谷歌称为Archived。更多信息我们可以找... 查看详情

替代已弃用的 setup_environ() 一次性 django 脚本?

】替代已弃用的setup_environ()一次性django脚本?【英文标题】:Alternativetothedeprecatedsetup_environ()forone-offdjangoscripts?【发布时间】:2013-02-0912:48:39【问题描述】:不久前我使用setup_environ()编写了一个一次性的python脚本,该脚本可以从... 查看详情

替代已弃用的 setup_environ() 一次性 django 脚本?

】替代已弃用的setup_environ()一次性django脚本?【英文标题】:Alternativetothedeprecatedsetup_environ()forone-offdjangoscripts?【发布时间】:2013-02-0912:48:39【问题描述】:不久前我使用setup_environ()编写了一个一次性的python脚本,该脚本可以从... 查看详情

OpenCV 中的 VideoReader 已弃用。 OpenCV 是不是有任何更新或任何替代?

...updatefromOpenCVoranysubstitution?OpenCV中的VideoReader已弃用。OpenCV是否有任何更新或任何替代?【发布时间】:2019-02-0212:52:52【问题描述】:我正在进行视频解码以抓取帧以进行一些后 查看详情

OAuth2FeignRequestInterceptor 的替代方案,依赖于已弃用的类

】OAuth2FeignRequestInterceptor的替代方案,依赖于已弃用的类【英文标题】:AlternativeforOAuth2FeignRequestInterceptorthatdependsonadeprecatedclass【发布时间】:2020-05-0511:07:44【问题描述】:免责声明:老实说,我尝试在google/github上搜索,扫描了... 查看详情