ios - StoreKit doesn't like product identifiers loaded from a pList -


i have been trying storekit work on last 2 days. found many possible faults , remedies via stack overflow. haven't seen particular problem mentioned anywhere.

the first code snippet shows works in project. uses hardcoded product id string , returns skproduct via appropriate delegate function. works on both device , simulator (ios 8.4).

private var request : skproductsrequest? func fetchproducts() {            self.request = skproductsrequest(productidentifiers: set(["testproducta","test product a"]))     self.request?.delegate = self     self.request?.start() } 

but if use same product id loaded plist, doesn't work anymore. typically vague error "cannot connect store". why not working escapes me moment.

func fetchproducts() {     if let productlist = nsbundle.mainbundle().urlforresource("products", withextension: "plist"),         let productidentifiers = nsarray(contentsofurl: productlist) as? [string]     {         self.request = skproductsrequest(productidentifiers: set(arrayliteral: productidentifiers))         self.request?.delegate = self         self.request?.start()     } } 

found solution. had change how set created.

self.request = skproductsrequest(productidentifiers: set<string>(productidentifiers)) 

Comments