iOS In-App Purchases invalid product identifier in ONLY iOS6 - ios

I'm trying to test In App Purchase within the sandbox environment.
And I've checked all http://troybrant.net/blog/2010/01/invalid-product-ids/ methioned.
It's my code of getting products response from APPLE SERVER.
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
NSLog(#"############ REQUEST RECEIVED RESPONSE %#", response.products);
for (NSString *productID in response.invalidProductIdentifiers) {
NSLog(#"Invalid product identifier: %#", productID);
}
}
I can get all my products with iOS5.X devices. But all invalidProductIdentifiers with iOS6.x devices. I'm very confused. I have no idea about what can cause this.
It's my test results below.
I've tested in all versions of simulator, FINE
*Device *iOSVersion Result
ipod3 5.0 FINE
iphone4 5.1.1 FINE
ipod5 6.1.2 Invalid Product Identifiers
iphone5 6.1.3 Invalid Product Identifiers
anyone has some ideas? Any help is appreciated.

iOS 6 Simulator does not support testing In-App Purchase.
Please use a device to test your apps that use this feature.
Please Check This Link :
http://developer.apple.com/library/ios/#releasenotes/General/RN-iOSSDK-6_0/

Related

"Not Authenticated" (9/1002) error while accessing cloud kit public database

I have integrated cloudkit framework in one of my iOS app and is working fine in iOS 8 and 9 but not in iOS 10. It fails to fetch the records from public database without active iCloud account. Able to fetch the records in iOS 8 and 9 if user restricted iCloud drive for the app also but it fails in iOS 10, getting error like
CKError 0x170249090: "Not Authenticated" (9/1002); "No backing
account, so not returning an auth token."
It is not working for both development and production cloudkit environments in iOS devices.
I have tested the app with AdHoc build pointing to production.
Below is my code
CKQuery *query = [[CKQuery alloc] initWithRecordType:#"RecordSettings" predicate:[NSPredicate predicateWithFormat:#"TRUEPREDICATE"]];
CKQueryOperation *queryOperation = [[CKQueryOperation alloc] initWithQuery:query];
queryOperation.queuePriority = NSOperationQueuePriorityVeryHigh;
queryOperation.recordFetchedBlock = ^(CKRecord *record) {
if(record != nil) {
}
};
queryOperation.queryCompletionBlock = ^(CKQueryCursor * __nullable cursor, NSError * __nullable operationError) {
NSLog(#"iCloud error: %#", operationError.description);
};
[[[CKContainer defaultContainer] publicCloudDatabase] addOperation:queryOperation];
You need to log in using your iCloud account on simulator or device. It worked for me.
The answer is in the section Enter iCloud Credentials Before Running Your App:
In development, when you run your app through Xcode on a simulator or a device, you need to enter iCloud credentials to read records in the public database. In production, the default permissions allow non-authenticated users to read records in the public database but do not allow them to write records.
I am having the same issue. Everything worked great until iOS10. The only thing so far that I have found to fix this is for the user to have iCloud Drive enabled on their device to fetch any record in a public container. I'm in the process of filing a bug report with Apple!
This issue exists from iOS 10.0 to 10.1.1 but it has been resolved in iOS 10.2.

App search results not showing up in spot light iOS

I implemented App Search using CoreSpotLight framework. The results are still not showing up in iOS spotlight
The approach i followed is
Created CSSearchableItemAttributeSet with title, keywords and contentDescription
Created CSSearchableItem with above created attributes set.
Added the CSSearchableItem to CSSearchableIndex
Every thing seems to be correct, not sure why the results are not showing up..
Finally managed to find the issue,
The simulator ( iPad Retina 9.3 ) which i was using, is not supported for core spotlight. We can find the unsupported devices names in apple docs
Although app search is available for iOS 9 users, the search functionality of NSUserActivity and Core Spotlight is not supported on iPhone 4s, iPad 2, iPad (3rd generation), iPad mini, and iPod touch (5th generation).
Also,
The following code was throwing an error
[[CSSearchableIndex defaultSearchableIndex] indexSearchableItems:#[item] completionHandler:^(NSError * _Nullable error) {
if (error) {
NSLog(#"Error :%#",error);
}
}];
The log is Error : Error Domain=CSIndexErrorDomain Code=-1005 "(null)”, which means CSIndexErrorCodeIndexingUnsupported , Indexing isn't supported on this device.
Hope this save time for someone.
Edit
As #rmaddy suggests, check for CSSearchableIndex isIndexingAvailable, this straightaways help to find the issue.

HealthKit requestAuthorization dialog not appearing

I have been consistently unable to get the HealthKit requestAuthorization dialog to appear. This has been the case for two different phones with different OS versions and different installation methods (see below). The requestAuthorization code is standard boilerplate code, such as:
HKCharacteristicType *genderType = [HKObjectType characteristicTypeForIdentifier:HKCharacteristicTypeIdentifierBiologicalSex];
[self.healthStore requestAuthorizationToShareTypes:nil readTypes:[NSSet setWithObjects: genderType, nil] completion:^(BOOL success, NSError *error) {
NSLog(#"requestAuthorization completion block");
}];
I've tried a fresh app with just that code, tried different parameters for the requestAuthorization method call, and have tried resetting our systems in a number of different ways: app uninstall, resetting settings, erasing phone content and setting with existing partial backup; erasing phone content and settings with a full backup, erasing content and settings and starting phone as a new phone. Have tried multiple different readTypes and shareTypes. Each time requestAuthorization is called on a fresh app install, the following error code appears:
"Error occurred = Error Domain=com.apple.healthkit Code=4 "Missing
com.apple.developer.healthkit entitlement." UserInfo=0x7fa748534b00
{NSLocalizedDescription=Missing com.apple.developer.healthkit
entitlement.}"
However, the HealthKit entitlements are set in both Capabilities on xcode as well as Capabilities in the App ID on Apple Developer: Certificates, Identifiers, and Profiles.
- Questions: How do I fix this issue so the requestAuthorization dialog appears? What is a possible cause of phones getting into a state where they get this error consistently?
- Phones used: iPhone 6, iPhone 6 Plus
- OS Versions used: iOS 9.0 / 9.0.2 / 9.1 / 9.2
- Methods of loading app onto phone: iOS App Store, Watch App App Store, TestFlight, xcode
- Situations where this appears to not be broken: With our users' (non-development) phones installing via the App Store.
A few things could be causing this. First, your provisioning profiles could be out of date with what you are actually seeing on the web portal. Try refreshing these manually from XCode.
Does your app have an app extension or watchOS app that uses the HealthKit framework? Each of extension/watch app will have their own profiles on the web portal, and if the HealthKit framework has been added to any of them without having the entitlement added as well then this could also cause the error.

The advertisingIdentifier and identifierForVendor return "00000000-0000-0000-0000-000000000000"

I've implemented this methods to get advertisingIdentifier and identifierForVendor:
- (NSString *) advertisingIdentifier
{
if (!NSClassFromString(#"ASIdentifierManager")) {
return [OpenUDID value];
}
return [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
}
- (NSString *) identifierForVendor
{
if ([[UIDevice currentDevice] respondsToSelector:#selector(identifierForVendor)]) {
return [[[UIDevice currentDevice] identifierForVendor] UUIDString];
}
return #"";
}
- (BOOL)isAdvertisingTrackingEnabled
{
if (NSClassFromString(#"ASIdentifierManager") && ![[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]) {
return NO;
}
return YES;
}
On simulator everything is working as should be and I can get the 2 strings IDs representation.
But when I run from iPhone 3GS with iOS 6.0 (10A403), these 2 methods return "00000000-0000-0000-0000-000000000000" as identifier.
Already done:
Restarted the device
Removed the app and reinstalled
Created and Ad-Hoc build, installed, removed and installed again
Run this code from another app
Tested on iPad 2 with iOS 6.0 (10A403) and everything went ok (I've got the correct identifiers)
It appears to be a bug in iOS. Seeing the same issue on devices that have been upgraded over-the-air, but devices upgraded with Xcode or iTunes work as expected without zeros.
Tried similar steps as you, and the only common theme was over-the-air (bad) versus tethered upgrade (good).
Update: Users that move directly from iOS 5.1 to 6.1 over-the-air experience a different behavior. Every time the app is closed completely and restarted, a new value is being returned by identifierForVendor. This would be expected if the app was being uninstalled and reinstalled, but that's not the case.
Apple confirmed this bug in their system in response to a Technical Support Incident request. They said that identifierForVendor and advertisingIdentifier sometimes
returning all zeros can be seen both in development builds and apps downloaded over the air from the App Store. They have no work around and can't say when the problem will be fixed.
There are some situations where API returns empty response for ID like after device restore.
Suggestion is to postpone ID retreival, so you can call sometginh like this:
-(void)retrieveID
{
if (<check fails>)
[self performSelector:#"retrieveID" withObject:nil afterDelay:1.0];
}
And fetch ID later.

InApp not working with iOs 5.1.1

my app has an inApp purchase which is working fine with my ipad having iOS 5.0.
Now the same build when tested with iOS 5.1.1 giving error in inApp Purchase "Cannot connect to iTunes Store". While debugging i am getting the product list succesfully but getting error when i try to purchase that product...
SKPayment *payment = [SKPayment paymentWithProductIdentifier:productIdentifier];
Is anybody facing this type of error for inApp purchase? Any suggestion will be of great help.
Thanks.
This solution works for me:-
Go to Setting--->General--->Reset--->Reset All Setting, and it's working fine.
You're using paymentWithProductIdentifier: which is deprecated in iOS 5.0, maybe that's the problem.
Try using :paymentWithProduct: instead.
"paymentWithProductIdentifier:
Returns a new payment with the specified product identifier. (Deprecated in iOS 5.0.)" http://developer.apple.com/library/ios/documentation/StoreKit/Reference/StoreKit_Collection/StoreKit_Collection.pdf

Resources