这是我的问题:
当使用storekit进行应用内购买时,我正在显示一个"加载"视图,告诉用户在进程正在进行时等待几秒钟; 但是让我们说同一个用户,当storekit询问他的itunes帐户密码时,按下"取消"按钮......我怎样才能"抓住"这个事件以隐藏加载视图?
因为用户的沟通非常重要,所以我担心这可能是苹果拒绝的原因.
谢谢你的任何提示!
编辑:我不在这里做交易; 我的第一步是恢复已完成的事务,以便通过此方法触发密码提示:
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions]
Run Code Online (Sandbox Code Playgroud) 我有个问题.永远不会调用SKProductsRequest委托方法.这是先前被问到的,但它没有答案.StoreKit委托函数未被调用
我不是母语为英语的人,有时听起来很滑稽:P :(
我想在我的iOS应用程序中实现StoreKit.我创建了一个类来处理所有StoreKit通信.这是代码:
@implementation VRStoreController
- (void) requestProducts
{
SKProductsRequest *request= [[SKProductsRequest alloc]
initWithProductIdentifiers:
[NSSet setWithObject: @"myProductID"]];
request.delegate = self;
[request start];
[[UIApplication sharedApplication]setNetworkActivityIndicatorVisible:YES];
}
- (void) productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
NSLog(@"F7U12");
[[UIApplication sharedApplication]setNetworkActivityIndicatorVisible:NO];
NSArray *myProducts = response.products;
NSLog(@"%@", myProducts);
}
Run Code Online (Sandbox Code Playgroud)
我在我的app委托中创建了一个实例
@interface VRAppDelegate
@property (strong, nonatomic) VRStoreController *store;
@end
Run Code Online (Sandbox Code Playgroud)
奇怪的是,当我在appDidFinishLaunching:方法中运行[store requestProducts]时,此代码可以正常工作.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//app initialization...
self.store = [[VRStoreController alloc]init];
[store requestProducts]; //This works ok, delegate method gets called.
return YES;
}
Run Code Online (Sandbox Code Playgroud)
但是当我在设置tableView:didSelectRowAtIndexPath中运行代码时:委托方法永远不会被调用. …
我正在尝试在swift中创建一个应用内购买.在我的班级签名中,我有以下内容:
class ViewController: UIViewController, UITextFieldDelegate, UIAlertViewDelegate,
SKStoreProductViewControllerDelegate, SKPaymentTransactionObserver{
Run Code Online (Sandbox Code Playgroud)
但是,我收到一条错误消息:类型"ViewController"不符合协议:SKPaymentTransactionObserver
我读过这个:https://developer.apple.com/library/prerelease/mac/documentation/Swift/Conceptual/BuildingCocoaApps/WritingSwiftClassesWithObjective-CBehavior.html并在ViewController中符合协议,在Swift中
SKSoreProductViewControllerDelegate工作正常.我错过了什么?
我试图在应用程序中实现自动更新订阅,它的工作方式如下:
现在的问题是:当到期日期到来时,我应该在我的webService或应用程序中验证收据吗?
如果它在webService上,我是否应该尝试验证旧收据(已存储),如果续订或取消,Apple会向我返回最新的收据?
如果它在应用程序上我该怎么办?订阅续订或取消时,是否存在来自storeKit的某种通知?
如果正确的方法是第二个(App),因为我的webService控制用户的角色是免费还是VIP,每次更新时我都必须将最新的收据发送到我的webService,因此,它可以管理用户的角色正常.这就是我需要知道如何以及何时获取最新收据的原因.
我正在我的设备上测试一个新应用程序,今天,我开始集成 StoreKit 以进行应用程序内购买。
问题是每次我启动应用程序时,它都会询问我的沙箱帐户密码。在下文中,您将找到有关该问题的一些详细信息。
StoreKit 开始在一个不是 rootView 的视图中做它的东西,所以我排除了我以编程方式抛出错误的情况......
那么,我之后做了什么?
问题仍然存在。请记住,要求的密码是 testuser1@t.com(第一个测试帐户!)
TL; DR:iOS上是否有某种方法可以检测iOS 10.3中添加的Storekit App Rating对话框的存在/显示?
我最近使用以下方法为我的应用添加了对新应用评级对话框的支持:
[SKStoreReviewController requestReview];
Run Code Online (Sandbox Code Playgroud)
但是,我知道有一些使用注意事项(如此处所述),即在调用上述功能时可能会或可能不会显示对话框,不是包括客户是否已对应用程序进行评级或客户已经暗淡的情况对话3次.
我也知道Apple不希望用户操作直接调用对话框的呈现,因此要报告对话框的存在:
虽然在应用程序的用户体验流程中有意义时应调用此方法,但评级/审阅请求视图的实际显示由App Store策略控制.由于此方法可能会或可能不会显示警报,因此响应按钮点击或其他用户操作来调用它是不合适的.
但这并不能阻止UX团队将这些按钮放在图形设计中并询问"我们能否知道对话框是否显示"?
所以,我的问题是,是否有其他间接方式可以确定此对话框的表示?
我最近使用Appium对Android和iOS应用程序进行了一些自动测试,并使用Xpaths查找原生UI元素,所以只是想知道是否可以在iOS应用程序的上下文中实现相同的功能.
当用户单击促销应用程序商店产品时,此代码就是在Apple开发人员网站上给出的代码,它告诉您检查是否可以完成交易?我该如何检查?因为那样的话我必须照顾交易是否失败或推迟,并且似乎无法弄清楚该怎么做。
//MARK: - SKPaymentTransactionObserver
func paymentQueue(_ queue: SKPaymentQueue, shouldAddStorePayment payment: SKPayment,
forProduct product: SKProduct) -> Bool {
// Check to see if you can complete the transaction.
// Return true if you can.
return true
}
Run Code Online (Sandbox Code Playgroud)
我还需要满足以下一些场景,这些场景与检查交易是否可以完成是相同的
func paymentQueue(_ queue: SKPaymentQueue, shouldAddStorePayment payment: SKPayment,
forProduct product: SKProduct) -> Bool {
// ... Add code here to check if your app must defer the transaction.
let shouldDeferPayment = ...
// If you must defer until onboarding is completed, then save the …Run Code Online (Sandbox Code Playgroud) 最近,应用商店服务器 API 中添加了一种新的 API查找订单 ID 。以及由 App Store 签名的此 API 响应的JWSTransaction ,采用 JSON Web 签名格式。我们想用 go 来验证一下。
我们尝试过什么
type JWSTransaction struct {
BundleID string `json:"bundleId"`
InAppOwnershipType string `json:"inAppOwnershipType"`
TransactionID string `json:"transactionId"`
ProductID string `json:"productId"`
PurchaseDate int64 `json:"purchaseDate"`
Type string `json:"type"`
OriginalPurchaseDate int64 `json:"originalPurchaseDate"`
}
func (ac *JWSTransaction) Valid() error {
return nil
}
func (a *AppStore) readPrivateKeyFromFile(keyFile string) (*ecdsa.PrivateKey, error) {
bytes, err := ioutil.ReadFile(keyFile)
if err …Run Code Online (Sandbox Code Playgroud) 我已经在这里发布了类似的问题,但我意识到我的问题可能更多地与 x509 证书有关,而不是与 JWS 一般有关。
事情是这样的,我对 JWS 还很陌生,Apple 现在将它们作为服务器到服务器通信的一部分进行传输。我试图了解如何完全保证JWS的有效性,因为据我了解,签名验证仅意味着整个JWS没有被篡改。我不知道如何实际验证此有效负载确实来自受信任的来源(又名Apple)。
这是我到目前为止所得到的(PHP):
//1. explode jws and decode what's needed
$components = explode('.', $jws);
$headerJson = json_decode(base64_decode($components[0]),true);
$signature = base64Url_decode($components[2]);
//2. extract all certificates from 'x5c' header
foreach ($headerJson['x5c'] as $x5c){
$c = '-----BEGIN CERTIFICATE-----'.PHP_EOL;
$c .= chunk_split($x5c,64,PHP_EOL);
$c .= '-----END CERTIFICATE-----'.PHP_EOL;
$certificates[] = openssl_x509_read($c);
}
//3. verify validity of certificate chain (each one is signed by the next, except root cert)
for($i = 0; $i < count($certificates); $i++){ …Run Code Online (Sandbox Code Playgroud) I'm trying to add/manage my first in-app purchase (non-consumable) on my iOS app and I just discovered that StoreKit 2 doesn't work well offline.
These past days, I used to display (or not) the premium features based on store.purchasedItems.isEmpty but this doesn't work at all on Airplane mode.
I mean, I understand that some parts of my Store file can't be accessible offline. The fetch request from the App Store can only works online, for example. But I didn't expected …
storekit in-app-purchase app-store-connect swiftui storekit2