IOKit not permitted in Sandbox? - macos

I'm new to using IOKit and have noticed what I think is the sandbox making it fail.
Here is the test I'm trying (in Pascal) which runs fine outside the sandbox but when I enable it IOServiceOpen returns the error kIOReturnNotPermitted every time.
Is IOKit not safe in the sandbox for certain services? I was trying to get some fan speeds/cpu temperatures and I see there are some apps in the AppStore (sandboxed) doing this so I believe it's possible. The only one I could confirm appears to have an XPC service bundled with the app as a helper so maybe that's a clue to make IOKit work? I tried basically all the entitlements and none of them seemed to help any.
Thanks for any ideas you may have.
procedure TestIOKit;
var
err: kern_return_t;
masterPort: mach_port_t;
iterator: io_iterator_t;
device: io_object_t;
matchingDictionary: CFMutableDictionaryRef;
conn: io_connect_t;
begin
IOMasterPort(0, masterPort);
matchingDictionary := IOServiceMatching('AppleSMC');
err := IOServiceGetMatchingServices(masterPort, matchingDictionary, iterator);
if err <> kIOReturnSuccess then
writeln('IOServiceGetMatchingServices: ', err);
device := IOIteratorNext(iterator);
IOObjectRelease(iterator);
if device = 0 then
writeln('no smc found');
err := IOServiceOpen(device, mach_task_self_, 0, conn);
if err <> kIOReturnSuccess then
writeln('IOServiceOpen: ', err);
end;

I found the same problem trying to read SMC keys in order get sensor temps and fan speeds from inside an OSX Yosemite 'Today extension'. The extension needs to be sandboxed, and I was also getting the kIOReturnNotPermitted error every time I tried to read the temp and fan sensors.
The only way I got it working was by creating a XPC service that manages all the SMC stuff, configured as a launch agent. This way, the sandboxed app (the 'today' extension) asks the XPC service for all the relevant data, instead of messing with IOKit directly.
So far, it seems to be working properly.

You don't need an XPC (not sure I understand that answer given it would also need to be sandboxed).
You can use this temporary entitlement although I don't hold any hope of apple approving it for MAS - you'd need to make your case to try and justify its use in iTunes connect. I have a similar problem and it's the only "solution" i've found so far:
com.apple.security.temporary-exception.sbpl string (allow iokit-open)

I don't see the answer from Luis Glez provide a solution but wrong information.
In fact there is currently no way to access this I/O Kit functionality from a sandboxed app neither would it be approved by Apple for the App Store.
If you check sandbox status of the app from from Luis Glez you will see that it's not sandboxed at all. Also it's not available at the App Store and I assume this is the reason.
Terminal:
codesign --display --entitlements - VitalStats.app
There was a recent discussion on the Developer Forums and someone from Apple confirmed that there is no way.
https://devforums.apple.com/message/1082393#1082393

The solution is very simple. You need to add a few lines in the file entitlements
<key>com.apple.security.temporary-exception.sbpl</key>
<array>
<string>(allow iokit-open)</string>
<string>(allow iokit-set-properties (iokit-property "ConsoleUID"))</string>
<string>(allow mach-lookup (global-name "com.apple.AssetCacheLocatorService"))</string>
</array>

My app was just rejected for using IOKit in general. Does anyone else have the same problem? The app was approved for 60 earlier builds, but all of the sudden, Apple seems to have a problem with that now. I use IOKit to read battery information like current voltage etc.
Rejected because of 1.1.6 - Safety.
Thank you for your submission. During our review, we found that your app is not appropriate for the App Store.
We encourage you to review your app concept and evaluate whether you
can incorporate different content and features to bring it into
compliance with the App Store Review Guidelines.

For those who may still look for answer, in Catalina, the problem might be that the app first needs to get the Input Monitoring permission, if it's not granted or denied - You would certainly get kIOReturnNotPermitted error.
To try if this is the case, go to System Settings, Privacy, select Input Monitoring and check if Your app is allowed.
After granting the permission the error should disappear

Related

Trouble Testing IAP with Sandbox

I cannot sign in with Sandbox tester ID (the fields are not even displayed in Settings-App Store).
I am running Xcode 14.2 and attempting to test on a developer-signed physical device (iOS 16.1.2). Following the steps in Apple documentation ("Setting up StoreKit Testing in Xcode"), I have been able to run tests using using local StoreKit configuration file. All works well. I next wanted to try to use Sandbox Testing. Following the same documentation,
I set up a Sandbox Tester in Apple Store Connect.
I saved a Public Certificate from the storekit configuration file in
the project.
I removed the local StoreKit configuration file from the scheme’s run
options (by setting to "none").
I added the following conditional compilation block to my store
manager:
#if DEBUG
let certificate = "StoreKitTestCertificate"
#else
let certificate = "AppleIncRootCertificate"
#endif
It is my understanding that an option to sign in with the SandBox ID should appear in device's App Store Settings after the first time I attempt to make a purchase when running on the device physically connected to my Mac.
This is not happening. Am I missing a step? One possible mistake I made was placing the (above) conditional compilation block in the wrong place. Can someone recommend the best place for this? The documentation says to paste it in with my receipt validation code. Another suspected oversight might be something else I need to do in Apple Store Connect. Not sure. Any help appreciated!
Addendum - I get this message in the console:
Error enumerating unfinished transactions for first transaction
listener: Error Domain=ASDErrorDomain Code=509 "No active account"
UserInfo={storefront-country-code=USA,
client-environment-type=Sandbox, AMSServerErrorCode=0,
NSLocalizedDescription=No active account}

Cannot upload hosted content for In-App purchases to iTunesConnect

I am trying to upload hosted content for in-app purchases, however I have been unable to succeed so far.
I have previously uploaded around 100 in-app purchases packages for my app using Application Loader. I used to be able to upload these packages before without any issues. Now I’ve noticed that the latest version of Application Loader (Version 3.0) doesn’t even give me the option to upload hosted content (see attached)?
So instead I’ve taken the time to use the iTMSTransporter bash script instead. However when I try to upload the content packs using:
iTMSTransporter -m upload
I am getting the following error:
Package Summary:
1 package(s) were not verified because they had problems:
/Users/Cortana/Documents/iOS/Clients/AccentKit/InAppContent/854413379.itmsp - Error Messages:
ERROR ITMS-90320: "The archive for In-App Purchase 'com.accentkit.AustraliaFemale1' is invalid. The 'IAPProductIdentifier' in the ContentInfo.plist must match the In-App Purchase Product ID."
[2018-04-14 07:12:45 MYT] DBG-X: Returning 1
I’ve double checked and the value for IAPProductIdentifier on the ContentInfo.plist matches exactly with what’s setup on the In-App Purchase Product ID on iTunesConnect. (see attached screenshots) This error is making no sense to me.
Any ideas?
If there was an issue with banking and your sales contract are according to you theoretically back in effect, they may not be effectively back in effect, that is, from Apple's servers point of view.
perhaps this is a process that takes up to a week and the only way to speed it up is to call their technical support.
this is where that'll happen : https://developer.apple.com/support/technical/
I suspect it's likely that your app having been on monetary lockdown at any one point while the bank was an issue may have led into this buggy situation that apple may not have accounted for or that they have accounted for and want you to first go through their IT support process in order for them to first be able to asses that everything is in order.
cheers! :)

Xcode cannot connect to member center

When I want to connect my developer account in xCode 6, I receive this message : "An error occurred while communicating with the member center."
Someone know what is the problem ? Someone can help me ? Thanks !
It might also be that there's a maintenance going on and the server is temporarily down. There's a system status website for developers indicating scheduled maintenances and temporary downtimes. Also check the Apple Developer Member Center website for this:
Then just sit back and brew yourself some hot cocoa.
I got the same message. In my case, my firstname (Björn) has an special character 'ö'. I changed it in my apple id profile to Bjoern and then it worked and i cloud submit to app store.
This is happening with accounts that have any special character like "í" or "ç" in their name. If you edit your Apple ID and remove any special characters it will work.
I hope this gets fixed before the official release.
This is a known issue that is being investigated - thank you for your bug reports. The issue is not in Xcode itself, but rather in services that it communicates with, so it cannot be addressed by an update to Xcode. -- Apple Support
I received this error because I had 3 appleID's in the account panel.
2 of them were old expired appleID's.
I removed them to keep only my active appleID.
And then the connection was succesful
Hope this will help

Cannot re-create app due to error "This Firebase URL is not available"

I decided to try out Firebase hosting and wanted to start fresh so I deleted my one and only app, but when I tried to create a new app with the same name I was unable to due to the error:
"This Firebase URL is not available"
I can only guess this is because of caching of app names/URLs? Hopefully it will become available (unless someone else beats me to it) after some timeout? Any info from others who have experience with this issue or otherwise know the answer is appreciated!
Not sure whether this is the right place to ask although Firebase suggest coming to SO because they apparently monitor Firebase-related questions closely according to their website.
Thanks!
Once you delete a Firebase URL, it is permanently unavailable. It cannot be recovered.
During confirmation, you should see a message like this, which explains in detail:
This stems from a number of abuse vectors that are possible by misappropriating a project id that the prior owner believes is deleted and could still have apps/releases in the wild attached to the defunct backend. Since compliance requires that we purge all data related to the project, including information about ownership, there's not even a way to restore one you personally deleted.

NSUbiquitousKeyValueStore error: com.xxxxx.xxxxx has no valid com.apple.developer.ubiquity-kvstore-identifier entitlement

Set up MKStorekit, also have Share kit, my store is not in the root view controller. I have security and storekit frameworks added and connected correctly, and am getting the following error:
NSUbiquitousKeyValueStore error: com.xxxx.xxxx has no valid com.apple.developer.ubiquity-kvstore-identifier entitlement
Someone else had this error and was told to wait a few hours. Well, I set up my products in iTunes Connect (they all say waiting for review) 3 weeks ago. The bank account information is correct because I've deposited money into the bank account to make sure, and I've been careful to follow all the instructions.
My app has nothing to do with iCloud, and therefore iCloud is not enabled.
I've been struggling getting IAP hooked up for 3 weeks now, and am about to give up on xcode programming forever lol... plllllllllease someone help me :/
there's a bunch of iCloud stuff in the MKStoreManger.m file, just commented it out and it fixed the error. Still no store, but it doesn't appear to be due to this

Resources