SKStoreProductViewController showing up with delay
up vote
8
down vote
favorite
I use in my app the SKStoreProductViewController
. It shows up correctly, but with a few seconds of delay, which slows down the user experience.
Is there something wrong in my code ? Or should I inform the user that the VC is loading ? Because right now one can believe that nothing is happening after pressing the button (which triggers the following code) :
-(void)launchApp:(id)sender {
// Recall on main thread if necessary
if (![NSThread isMainThread]) {
[self performSelectorOnMainThread:@selector(launchApp:)
withObject:sender
waitUntilDone:NO];
return;
}
// Initialize Product View Controller
SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewController alloc] init];
// Configure View Controller
[storeProductViewController setDelegate:self];
[storeProductViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier : @"*********"}
completionBlock:^(BOOL result, NSError *error) {
if (error) {
NSLog(@"Error %@ with User Info %@.", error, [error userInfo]);
} else {
// Present Store Product View Controller
[self presentViewController:storeProductViewController animated:YES completion:nil];
}
}];
}
ios storekit
add a comment |
up vote
8
down vote
favorite
I use in my app the SKStoreProductViewController
. It shows up correctly, but with a few seconds of delay, which slows down the user experience.
Is there something wrong in my code ? Or should I inform the user that the VC is loading ? Because right now one can believe that nothing is happening after pressing the button (which triggers the following code) :
-(void)launchApp:(id)sender {
// Recall on main thread if necessary
if (![NSThread isMainThread]) {
[self performSelectorOnMainThread:@selector(launchApp:)
withObject:sender
waitUntilDone:NO];
return;
}
// Initialize Product View Controller
SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewController alloc] init];
// Configure View Controller
[storeProductViewController setDelegate:self];
[storeProductViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier : @"*********"}
completionBlock:^(BOOL result, NSError *error) {
if (error) {
NSLog(@"Error %@ with User Info %@.", error, [error userInfo]);
} else {
// Present Store Product View Controller
[self presentViewController:storeProductViewController animated:YES completion:nil];
}
}];
}
ios storekit
add a comment |
up vote
8
down vote
favorite
up vote
8
down vote
favorite
I use in my app the SKStoreProductViewController
. It shows up correctly, but with a few seconds of delay, which slows down the user experience.
Is there something wrong in my code ? Or should I inform the user that the VC is loading ? Because right now one can believe that nothing is happening after pressing the button (which triggers the following code) :
-(void)launchApp:(id)sender {
// Recall on main thread if necessary
if (![NSThread isMainThread]) {
[self performSelectorOnMainThread:@selector(launchApp:)
withObject:sender
waitUntilDone:NO];
return;
}
// Initialize Product View Controller
SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewController alloc] init];
// Configure View Controller
[storeProductViewController setDelegate:self];
[storeProductViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier : @"*********"}
completionBlock:^(BOOL result, NSError *error) {
if (error) {
NSLog(@"Error %@ with User Info %@.", error, [error userInfo]);
} else {
// Present Store Product View Controller
[self presentViewController:storeProductViewController animated:YES completion:nil];
}
}];
}
ios storekit
I use in my app the SKStoreProductViewController
. It shows up correctly, but with a few seconds of delay, which slows down the user experience.
Is there something wrong in my code ? Or should I inform the user that the VC is loading ? Because right now one can believe that nothing is happening after pressing the button (which triggers the following code) :
-(void)launchApp:(id)sender {
// Recall on main thread if necessary
if (![NSThread isMainThread]) {
[self performSelectorOnMainThread:@selector(launchApp:)
withObject:sender
waitUntilDone:NO];
return;
}
// Initialize Product View Controller
SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewController alloc] init];
// Configure View Controller
[storeProductViewController setDelegate:self];
[storeProductViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier : @"*********"}
completionBlock:^(BOOL result, NSError *error) {
if (error) {
NSLog(@"Error %@ with User Info %@.", error, [error userInfo]);
} else {
// Present Store Product View Controller
[self presentViewController:storeProductViewController animated:YES completion:nil];
}
}];
}
ios storekit
ios storekit
asked May 14 '13 at 14:53
rdurand
6,12633064
6,12633064
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
33
down vote
accepted
The delay is caused because you present the viewController after the products have been loaded sucesfully.
You can put the call presentViewController:animated:completion:
outside of the block that is called after the products have been loaded. In this case the controller will be presented empty, and it is filled after the products have been loaded.
Something along those lines:
SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewController alloc] init];
// Configure View Controller
[storeProductViewController setDelegate:self];
[storeProductViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier : @364709193}
completionBlock:^(BOOL result, NSError *error) {
if (error) {
NSLog(@"Error %@ with User Info %@.", error, [error userInfo]);
} else {
}
}];
// Present Store Product View Controller
[self presentViewController:storeProductViewController animated:YES completion:nil];
Or you could create a "popup" view that shows an activity indicator while the controller loads its content.
Or you use [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
There are a couple of ways to handle this.
Thanks, I forgot for a second the logic behind blocks.. I used the first solution and it's fine, as the VC has its own "loading" label. Thanks !
– rdurand
May 14 '13 at 15:25
1
@Matthias - any idea if it's possible to institute a timeout as well for the loadProductWithParameters call?
– runamok
Aug 6 '13 at 21:32
1
One note - Apple says you should pass your store identifier as a NSNumber rather than a NSString.
– Zack
Jun 13 '14 at 19:44
You're right. I fixed it. Thanks
– Matthias Bauch
Jun 13 '14 at 20:55
My app got rejected in the App Store. This saved me.
– vito.royeca
Jun 21 '16 at 3:08
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
33
down vote
accepted
The delay is caused because you present the viewController after the products have been loaded sucesfully.
You can put the call presentViewController:animated:completion:
outside of the block that is called after the products have been loaded. In this case the controller will be presented empty, and it is filled after the products have been loaded.
Something along those lines:
SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewController alloc] init];
// Configure View Controller
[storeProductViewController setDelegate:self];
[storeProductViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier : @364709193}
completionBlock:^(BOOL result, NSError *error) {
if (error) {
NSLog(@"Error %@ with User Info %@.", error, [error userInfo]);
} else {
}
}];
// Present Store Product View Controller
[self presentViewController:storeProductViewController animated:YES completion:nil];
Or you could create a "popup" view that shows an activity indicator while the controller loads its content.
Or you use [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
There are a couple of ways to handle this.
Thanks, I forgot for a second the logic behind blocks.. I used the first solution and it's fine, as the VC has its own "loading" label. Thanks !
– rdurand
May 14 '13 at 15:25
1
@Matthias - any idea if it's possible to institute a timeout as well for the loadProductWithParameters call?
– runamok
Aug 6 '13 at 21:32
1
One note - Apple says you should pass your store identifier as a NSNumber rather than a NSString.
– Zack
Jun 13 '14 at 19:44
You're right. I fixed it. Thanks
– Matthias Bauch
Jun 13 '14 at 20:55
My app got rejected in the App Store. This saved me.
– vito.royeca
Jun 21 '16 at 3:08
add a comment |
up vote
33
down vote
accepted
The delay is caused because you present the viewController after the products have been loaded sucesfully.
You can put the call presentViewController:animated:completion:
outside of the block that is called after the products have been loaded. In this case the controller will be presented empty, and it is filled after the products have been loaded.
Something along those lines:
SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewController alloc] init];
// Configure View Controller
[storeProductViewController setDelegate:self];
[storeProductViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier : @364709193}
completionBlock:^(BOOL result, NSError *error) {
if (error) {
NSLog(@"Error %@ with User Info %@.", error, [error userInfo]);
} else {
}
}];
// Present Store Product View Controller
[self presentViewController:storeProductViewController animated:YES completion:nil];
Or you could create a "popup" view that shows an activity indicator while the controller loads its content.
Or you use [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
There are a couple of ways to handle this.
Thanks, I forgot for a second the logic behind blocks.. I used the first solution and it's fine, as the VC has its own "loading" label. Thanks !
– rdurand
May 14 '13 at 15:25
1
@Matthias - any idea if it's possible to institute a timeout as well for the loadProductWithParameters call?
– runamok
Aug 6 '13 at 21:32
1
One note - Apple says you should pass your store identifier as a NSNumber rather than a NSString.
– Zack
Jun 13 '14 at 19:44
You're right. I fixed it. Thanks
– Matthias Bauch
Jun 13 '14 at 20:55
My app got rejected in the App Store. This saved me.
– vito.royeca
Jun 21 '16 at 3:08
add a comment |
up vote
33
down vote
accepted
up vote
33
down vote
accepted
The delay is caused because you present the viewController after the products have been loaded sucesfully.
You can put the call presentViewController:animated:completion:
outside of the block that is called after the products have been loaded. In this case the controller will be presented empty, and it is filled after the products have been loaded.
Something along those lines:
SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewController alloc] init];
// Configure View Controller
[storeProductViewController setDelegate:self];
[storeProductViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier : @364709193}
completionBlock:^(BOOL result, NSError *error) {
if (error) {
NSLog(@"Error %@ with User Info %@.", error, [error userInfo]);
} else {
}
}];
// Present Store Product View Controller
[self presentViewController:storeProductViewController animated:YES completion:nil];
Or you could create a "popup" view that shows an activity indicator while the controller loads its content.
Or you use [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
There are a couple of ways to handle this.
The delay is caused because you present the viewController after the products have been loaded sucesfully.
You can put the call presentViewController:animated:completion:
outside of the block that is called after the products have been loaded. In this case the controller will be presented empty, and it is filled after the products have been loaded.
Something along those lines:
SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewController alloc] init];
// Configure View Controller
[storeProductViewController setDelegate:self];
[storeProductViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier : @364709193}
completionBlock:^(BOOL result, NSError *error) {
if (error) {
NSLog(@"Error %@ with User Info %@.", error, [error userInfo]);
} else {
}
}];
// Present Store Product View Controller
[self presentViewController:storeProductViewController animated:YES completion:nil];
Or you could create a "popup" view that shows an activity indicator while the controller loads its content.
Or you use [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
There are a couple of ways to handle this.
edited Jun 13 '14 at 20:54
answered May 14 '13 at 15:05
Matthias Bauch
82.8k15205241
82.8k15205241
Thanks, I forgot for a second the logic behind blocks.. I used the first solution and it's fine, as the VC has its own "loading" label. Thanks !
– rdurand
May 14 '13 at 15:25
1
@Matthias - any idea if it's possible to institute a timeout as well for the loadProductWithParameters call?
– runamok
Aug 6 '13 at 21:32
1
One note - Apple says you should pass your store identifier as a NSNumber rather than a NSString.
– Zack
Jun 13 '14 at 19:44
You're right. I fixed it. Thanks
– Matthias Bauch
Jun 13 '14 at 20:55
My app got rejected in the App Store. This saved me.
– vito.royeca
Jun 21 '16 at 3:08
add a comment |
Thanks, I forgot for a second the logic behind blocks.. I used the first solution and it's fine, as the VC has its own "loading" label. Thanks !
– rdurand
May 14 '13 at 15:25
1
@Matthias - any idea if it's possible to institute a timeout as well for the loadProductWithParameters call?
– runamok
Aug 6 '13 at 21:32
1
One note - Apple says you should pass your store identifier as a NSNumber rather than a NSString.
– Zack
Jun 13 '14 at 19:44
You're right. I fixed it. Thanks
– Matthias Bauch
Jun 13 '14 at 20:55
My app got rejected in the App Store. This saved me.
– vito.royeca
Jun 21 '16 at 3:08
Thanks, I forgot for a second the logic behind blocks.. I used the first solution and it's fine, as the VC has its own "loading" label. Thanks !
– rdurand
May 14 '13 at 15:25
Thanks, I forgot for a second the logic behind blocks.. I used the first solution and it's fine, as the VC has its own "loading" label. Thanks !
– rdurand
May 14 '13 at 15:25
1
1
@Matthias - any idea if it's possible to institute a timeout as well for the loadProductWithParameters call?
– runamok
Aug 6 '13 at 21:32
@Matthias - any idea if it's possible to institute a timeout as well for the loadProductWithParameters call?
– runamok
Aug 6 '13 at 21:32
1
1
One note - Apple says you should pass your store identifier as a NSNumber rather than a NSString.
– Zack
Jun 13 '14 at 19:44
One note - Apple says you should pass your store identifier as a NSNumber rather than a NSString.
– Zack
Jun 13 '14 at 19:44
You're right. I fixed it. Thanks
– Matthias Bauch
Jun 13 '14 at 20:55
You're right. I fixed it. Thanks
– Matthias Bauch
Jun 13 '14 at 20:55
My app got rejected in the App Store. This saved me.
– vito.royeca
Jun 21 '16 at 3:08
My app got rejected in the App Store. This saved me.
– vito.royeca
Jun 21 '16 at 3:08
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f16546431%2fskstoreproductviewcontroller-showing-up-with-delay%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown