What is this vendorID error message associated with “Cannot Connect to iTunes” for in-app purchase?

て烟熏妆下的殇ゞ 提交于 2019-12-22 13:55:27

问题


Here's a mysterious error message:

LaunchServices: failed to get vendorID

I'm guessing it's some Apple server that is down right now, and will be back online, sometime soon.

Background:

My iOS app has no in-app purchases previously approved, so this is still the stage where a new version of the app must be submitted along with a new in-app purchase product. There are three test users configured in iTunes Connect.

Testing before today has been successful with buying test products, and retrieving previous purchased info.

What happened at time of "break"

Earlier today I was added some server fetch code to validate the transactions. This code executes after the processing of the transaction queue, so after a successful fetch of information.

What's happening now

The in-app purchase code requests the products using the StoreKit framework, and receives them and displays the UI appropriately. So there is at least some level of success with StoreKit at the moment.

When I tap the UI button to launch the retrieve-past-purchases code, I enter the credentials for a test user, and I sit and wait. Timeout, it would seem, for many seconds later, the error "Cannot connect to iTunes Store" appears.

This occurs on both the iPhone device and simulator.

But the error message in the output pane of Xcode while running the app is showing the following error, and it appears immediately when I'm pressing the button to restore the transactions, and again when the connection fails with test user.

LaunchServices: failed to get vendorID

What I did to try to fix it

On the iPhone, I signed out of my real user and then used the test user credentials, and in simulator, I cleaned out the ~/Library/Application Support/iPhone Simulator/6.1/Library/com.apple.itunesstored/* files.

I restarted the macbook, same thing.

A google search for: +"failed to get vendorID"

returns zero real results. I'm at a loss.


回答1:


It looks like static library projects don't have access to the vendorID, but they do have access to the advertiserID.

This may be an artifact of running the tests inside the simulator in XCode—perhaps a static library has access to the vendorID when linked into a real app run on a real device.

I ran a brief test of two different scenarios, and was able to reliably make the LaunchServices: failed to get vendorID error appear under one of them.

First, I created an "Empty Application" in XCode using the built-in template. I altered only this method:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    NSLog(@"Vendor ID: %@", [UIDevice currentDevice].identifierForVendor);

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    return YES;
}

This one never had a problem. Both when I ran the app directly in the simulator, and when I ran its (generated) unit tests, it was able to get the UUID of this device for the vendor just fine.

Then I created a "Cocoa Touch Static Library" in the XCode template. I created only one class method on the generated source file.

+ (void)logDeviceIDs
{
    NSLog(@"Vendor ID: %@", [UIDevice currentDevice].identifierForVendor);
    NSLog(@"Advert ID: %@", [ASIdentifierManager sharedManager].advertisingIdentifier);
}

I then altered the generated test

- (void)testExample
{
    [ReportDevice logDeviceIDs];
}

And finally I made sure to alter the "ReportDeviceTests" target and add the AdSupport library to be linked in. And then when I executed the tests, the simulator popped up and this is the output I saw:

ReportDeviceTests.octest(Tests)' started at 2013-08-04 03:56:00 +0000
Test Suite 'ReportDeviceTests' started at 2013-08-04 03:56:00 +0000
Test Case '-[ReportDeviceTests testExample]' started.
2013-08-03 21:56:00.786 otest[61857:303] LaunchServices: failed to get vendorID
2013-08-03 21:56:00.786 otest[61857:303] Vendor ID: (null)
2013-08-03 21:56:00.787 otest[61857:303] Advert ID: <__NSConcreteUUID 0x24bab30> 5801847F-4679-4701-8B07-28449EF92CB4
Test Case '-[ReportDeviceTests testExample]' passed (0.002 seconds).

So in this test, the static library was able to get the advertisingIdentifier but not the identifierForVendor, and was "successfully" able to trigger the failed to get vendorID error.

Is it possible that you're using static libraries you've written, or that come from an external vendor (say, Flurry)? Those are potential sources which might give you similar behavior to the last of the two test cases.

Hope that helps!




回答2:


I had this same problem running tests with xctool in a project with no host application. That is, I only had a test target. The solution for me was to add an application target, and set this as my host application for the test target (general tab for the test target). This is essentially recreating what would normally be setup when creating a new project in Xcode. In my case, I also had to add the AppDelegate with:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { return YES; }



来源:https://stackoverflow.com/questions/18022360/what-is-this-vendorid-error-message-associated-with-cannot-connect-to-itunes-f

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!