No bag entry - Cocoa - macos

I am working on a app written in Swift for Mac. I am using XCode 6.4 on OSX 10.10.4
I recently noticed some weird messages regarding in app purchases.
Initially when I run the app the method request:didFailWithError of SKProductsRequestDelegate is invoked as seen below
func request(request: SKRequest!, didFailWithError error: NSError!) {
println("Failed: \(error.localizedDescription)")
}
This code snippet prints Failed: No bag entry
Further, to solve this I cleaned the project to remove the old binary.
When I try to execute the newly build binary from finder it says
After clicking on Sign In nothing happens.
Questions
What exactly is No bag Entry?
Why is the alert (present in image) saying that I have already purchased the app, although I am testing in App Store Sandbox?
Note
The reason I am executing the App from Finder(outside Xcode) is that Mac applications are required to be executed outside Xcode for first time, so that it can fetch the Receipt from Apple Server
Mac App store is kept logged out through the entire process
This error popped up with out any reason. I am pretty much sure that something has to be done outside Xcode.
Update
Apple has updated the Technical note TN2206 on July 27 and the change is titled
Cover changes to linking to dynamic libraries outside of an app bundle.
I have dynamically linked openssl library in my app, I guess it has something to do with it.

I've seen the "No bag entry" error passed to my -request:didFailWithError: method in my SKProductsRequestDelegate twice so far whilst developing and testing my Mac app.
The full NSError I've seen is:
Error Domain=ISErrorDomain
Code=3 "No bag entry"
UserInfo={
NSLocalizedDescription=No bag entry,
NSLocalizedFailureReason=Could not find key 'p2-product-offers' in bag.
}
I don't know what p2-product-offers is: this isn't a string I'm using in my app.
From searching the web, it seems that ISErrorDomain is something to do with StoreKit.
Both times I've seen this, my Internet connection has been a bit flakey. My current guess is that this error means "the Internet connection dropped whilst StoreKit was retrieving the product information".

Related

error from Transporter, "failed to get the app's bundle id"

I'm preparing an app for the Mac OS app store. The app is a package that consists of a precompiled binary and a bunch of configuration parameters embedded in it's info.plist. The app isn't under development - it's been in use for several years, but I'm planning
to smooth the distribution by getting it into the app store.
I created a .pkg for the app using "productbuild", and the package installs fine.
My problem is that feeding the .pkg to the transporter app always fails with
"failed to create the .itmsp for .pkg Failed to get the apps bundle id"
the info.plist looks fine to me.
Q: what's wrong, what can I do about it, or is there an alternative path into the
app store.
This error seems to occur for many different reasons. In my case, my Info.plist had an empty value for the NSHumanReadableCopyright key and it was missing the LSMinimumSystemVersion key entirely. After adding both of those, and resubmitting, the error no longer occurs.
So my best advice for combatting this error message is to compare your Info.plist to a known good one and see if you are missing any keys or if any of the key values are empty or possibly invalid. Unfortunate that this error message is a red herring.
If you use xcrun altool --validate-app to attempt to upload your app rather than Transport, it will give you the reason why it is failing to upload. In my case, Transporter gave me the same vague error message you were getting. At first, I tried adding LSMinimumSystemVersion, but still failed with same vague error. Then I tried xcrun altool --validate-app, I get:
2021-03-29 00:35:11.876 altool[1291:17262] *** Error: Unable to validate archive 'myApp.pkg'.
2021-03-29 00:35:11.876 altool[1291:17262] *** Error: code -27002 (Unable to validate your application. The Info.plist in the package must contain the CFBundleShortVersionString key.)
After I then added CFBundleShortVersionString, I was moving on.
I assume you already made all steps needed before submitting your Mac App. So then the easiest way to send it to the Apple Store Connect is generating an Archive and using Organizer.
Open Xcode
Go to Product -> Archive
Wait until an Mac App Archive is generated
Go to Window -> Organizer
Select the version of your app that you want to submit and then click on Validate App
If everything is ok, proceed clicking on the button Upload App
Finally go to the Apple Store Connect and just publish it

macOS - The Gods are punishing me. The app's receipt fails miserably to load, no matter what I do

I have tested all solutions on similar questions on SO and they all failed for me.
I think mine is different because the application's receipt is not even loading.
I am having developing this macOS app for at least 7 months. The app contains Auto-Renewable Subscription.
Since day one, I am retrieving and validating its receipt with success. No problem at all. That were the good days.
January 3, 2020, I started working on the app again.
Since then, the app fails miserably to even load the receipt. No change in code, nothing.
Even a simple code like this, that is copied from Apple, fails.
// Get the receipt if it's available
if let appStoreReceiptURL = Bundle.main.appStoreReceiptURL,
FileManager.default.fileExists(atPath: appStoreReceiptURL.path) {
do {
let receiptData = try Data(contentsOf: appStoreReceiptURL, options: .alwaysMapped)
print(receiptData)
let receiptString = receiptData.base64EncodedString(options: [])
// Read receiptData
}
catch { print("Couldn't read receipt data with error: " + error.localizedDescription) }
} else {
exit(173)
print("this error stinks!")
}
this line
FileManager.default.fileExists(atPath: appStoreReceiptURL.path)
fails miserably. The receipt is not there.
This is what I have tried so far:
cry
restart the computer
delete ~/Library/Caches/com.apple.appstore
create a new sandbox user
try with an old sandbox user created years ago.
reinstall Xcode
log out of App Store and iCloud + restart the computer again.
killed the storeaccountd daemon + restart.
confirmed that the version and the bundleID on Info.plist are the same as in appstoreConnect.
Everything I get is
networkError(error: Error Domain=SKErrorDomain Code=0 "(null)")
exit(173) is triggered, I type the sandbox user then I get
The app is damaged and can’t be opened. Delete the app and download it again from the App Store.
I have had this problem on an iOS device application I was developing 10 years ago and the only way I have managed to solve that was by resetting the device to factory default. Sincerely, I will not reinstall macOS.
I am desperate. I have aged 20 years in the last couple of days.
Is there some cache or macOS service that might be clogged?
One thing I have noticed is that the box the pops to type the App Store credentials do not show the words sandbox as the boxes the pop when you try to buy the in-app purchase and that this boxes always comes pre-filled with an old sandbox user. Is there a way to clean that?
Any other ideas?
I have opened a technical incident with Apple and they were unable to solve that.
Someone suggested me the only thing that solved the problem: to create another user on the same Mac and test it from there.
PROBLEM SOLVED
If you are having this problem from iOS, the solution is to reset the device to factory defaults.
Note: apparently, this time, the whole problem was caused by Apple, after a half cooked update to their sandbox/production servers.

iTunes Connect and Xcode 8: your app has changed to invalid binary

Last week, with Xcode 7, I was able to upload without any issue. But today I am getting the message your app has changed to invalid binary.
I have seen that now with Xcode 8 a new icon 20x20 2x and 3x is added. I added one, but still getting the error.
Does anyone had similar problem?
Сheck your email!
In my case, I wasted a lot of time because I did not check my email. When you get such an error, Apple sends you an email with it's description.
For example, this is what Apple sent me:
"This app attempts to access privacy-sensitive data without a usage
description. The app's Info.plist must contain an
NSCameraUsageDescription key with a string value explaining to the
user how the app uses this data."
After days of wrestling with the same problem I finally got my app successfully submitted, but only after being on the phone with Apple Developer support.
A couple of things to keep in mind:
Make sure you set the Info.plist description keys for any entitlements. This is necessary for iOS apps. Mine was a macOS app, so this didn't apply.
Head over to iTunes Connect, and recreate all your provisioning profiles and code signing certificates if you're not 100% sure that they're valid. You can do it for both Developer and Distribution.
In Xcode, turn off automatic code signing for your app, and any build targets (you can try automatic code signing in Xcode after completing steps #2 and #4 but that wasn't what worked for me).
Go to Xcode preferences, and click your development team, and in the sheet that comes up, you should see some "Download" buttons beside the newly created (in iTunes Connect) code signing certificates and provisioning profiles. Click them all. And so you don't get confused in step #5, delete all the other stale provisioning profiles and code signing identities for this app.
In Build Settings for each of your targets, make sure that the Release build setting for code signing, and provision profile are set to the above newly created code signing certificate and provisioning profile.
Bump your build number.
Deep clean your project (Option-Shift-Command-K).
Archive build your app.
In the Organizer that opens up, select the newly archived app, and validate (it always validated, but I still would get Invalid Binary later).
Export the build and select the option "Save for Mac App Store Deployment" or similar.
When prompted, use the same Provisioning Profiles you used previously and save.
Open the .pkg in Application Loader which you can launch from Xcode > Open Developer Tool > Application Loader menu.
I was't getting any emails on the Invalid Binary issue. Instead, I was lucky enough to have set up my iPad with iTunes Connect, and so, like clock-work, I was getting notifications within a couple minutes of uploading the app: "Your app ... has changed to Invalid Binary."
If you don't get one of these Invalid Binary notifications, that's a good sign. Another 10-15 minutes later, I checked the iTunes Connect portal, and I could finally add the uploaded build and submit for review.
After a while of searching, as a last-ditch effort I added every possible 'NS...UsageDescription into each of my target's Info.plist and this seems to have worked. After process of elimination, I deduced that it was either the NSAppleMusicUsageDescription or the NSFaceIDUsageDescription key-string pair that was preventing the upload from being successful so I just added them even though I don't use either in my project. I have also read on some other threads that something with a new version of Xcode required them to have the NSAppleMusicUsageDescription even though they didn't use anything related to Apple Music.

Cloudkit error when querying public database from simulator

I'm working on an app where I recently decided to go with CloudKit and am now at the point where I need to implement the backend functionality. In a nutshell, this app will use a collectionview to display images retrieved from a CK database. Up until now, I just dumped some images in a folder on my desktop and retrieved/parsed the images from there to render the collectionview. I then used the CK dashboard to create some records and wrote an initialization method to try and retrieve them. I was getting various CKErrors, such as network failure, error completion without receiving a response from the server, could not send a valid signature, etc. I immediately assumed the issue was with my code since it was my first attempt with CloudKit. However, I ran the latest code on my device before posting on SO and it worked! I got a successful response with the number of records in the results array that I was expecting.
So now I know longer need help with fetching CKRecords like I initially thought. But how do I resolve this issue with the simulator? I saw some other post about making sure you're signed into iCloud on the simulator. I believe I am, but do not know how to check to be sure. Also, I'm running Yosemite and Xcode 6.1.
Any help is appreciated!
on the simulator go to the settings app. You can do that with menu hardware, home and then open the settings app, select iCloud and make sure that you are logged in.
To use your Apple ID on iCloud on the iPhone Simulator, make sure you turn off Two-way authentication. It should then work on the simulator.

Obtaining OS X app store receipts on test builds

Been trying tonight to obtain a receipt for my app. However, I've been unsuccessful. Here's the steps I've done:
Code signed with developer cert
Made sure minimum version in the info.plist is 10.7
Checked for the presence of the receipt file and called exit(173) if not found
Built from XCode 4.2
Added a new version of the app and some in-app metadata in itunesconnect. The app status is now waiting for a new binary.
I've then done clean, build, right clicked on the app in XCode's project view and opened it in finder to launch it, hopefully failing validation and pulling a receipt back from the store.
However, this never seems to happen (don't get asked for any itunes login etc) and the app terminates immediately.
I've also gone through an entire build/archive/create installer type process as well but that didn't pop up the login either.
Am I missing something obvious?
Thanks!
I've finally got it working. In case anyone else has a similar problem, the real help for me was finding out about console.app. In running this I could see my app didn't appear to be signed.
I deleted all the certificates etc and re-installed new ones. Seems it HAS to be the Mac 3rd party developer. Nothing else seemed to work.

Resources