Error while requesting a transaction - ios

When I requesting a CXTansaction in CXStratCallAction it showing the error message as "Error Domain=com.apple.CallKit.error.requesttransaction Code=1 "(null)" ". Can anyone explain this Error message.

From the header <CallKit/CXError.h>:
typedef NS_ERROR_ENUM(CXErrorDomainRequestTransaction, CXErrorCodeRequestTransactionError) {
...
CXErrorCodeRequestTransactionErrorUnentitled = 1,
...
} API_AVAILABLE(ios(10.0));
So error code 1 corresponds to CXErrorCodeRequestTransactionErrorUnentitled.
This error is usually returned when an app lacks the voip iOS App Background Mode. To fix this, open Xcode's Capabilities tab for the app target and enable the "VoIP" background mode, or add 'voip' to the UIBackgroundModes array within the app's Info.plist.
(I have filed a request in Apple's bug tracker to mention this in the documentation, Radar 35903988.)

The app isn’t entitled to perform the actions in the requested transaction.
Refer the link for error codes

Related

Getting a LaunchServices error when trying to share to apple Books on ios

I am stuck on a problem, I'm trying to share from my app to Apple Books on iOS. When I perform the share action, the ActivityViewController acts like it is preforming the operation and everything appears to go well, however the shared file never appears in Books.
In the xcode console I get a Launch Services error:
2020-02-09 14:48:25.031316+0700 AppName[1040:282769] [default] LaunchServices: open operation <NSBlockOperation: 0x103006010> failed with error: Error Domain=NSOSStatusErrorDomain Code=-54 "Query not allowed" UserInfo={NSDebugDescription=Query not allowed, _LSLine=320, _LSFunction=-[_LSLocalQueryResolver _enumerateResolvedResultsOfQuery:XPCConnection:withBlock:]}
service was canceled
I've looked around at what could be causing this and from what I can find, it seems most likely that my app does not have the correct permissions to access iBooks, but when I run UIApplication.canOpenURL for the iBooks schemes it comes back as true.
I opened up the simulator console as well where I found a bit more to this error:
Unentitled query <_LSDocumentProxyBindingQuery: 0x10253c750> issued from pid 1021. Disallowing and yielding an error.
Could not find apps for <private>: Error Domain=NSOSStatusErrorDomain Code=-54 "Query not allowed" UserInfo={NSDebugDescription=Query not allowed, _LSLine=320, _LSFunction=<private>}.
Invalid LSOpenOperation request: Error Domain=NSOSStatusErrorDomain Code=-54 "Query not allowed" UserInfo={NSDebugDescription=Query not allowed, _LSLine=320, _LSFunction=-[_LSLocalQueryResolver _enumerateResolvedResultsOfQuery:XPCConnection:withBlock:]}
LaunchServices: [Perform] not launching application - result = Error Domain=NSOSStatusErrorDomain Code=-54 "Query not allowed" UserInfo={NSDebugDescription=Query not allowed, _LSLine=320, _LSFunction=-[_LSLocalQueryResolver _enumerateResolvedResultsOfQuery:XPCConnection:withBlock:]}
But I can't seem to find why the query is unentitled, or how to set it to be allowed.
I have tried adding the ibooks URL scheme to both LSApplicationQueriesSchemes and CFBundleURLTypes but that didn't make a difference.
I also tried saving the file manually and setting the NSFileProtectionKey to none per this post showing the same console error (not completely sure I implemented this correctly however)
I also tried using another app I've created that uses the activityVC to see if that app could share to iBooks and I get the same problem and the same error.
Sharing to all other iOS apps works fine, it is just iBooks that has the problem.
Any point in the right direction would be really appreciated!

canOpenURL when returns false prints out an unnecessary error message

I am using canOpenURL to open the app if installed in the device. And added the LSApplicationQueriesSchemes to whitelist the Schemes. But when canOpenURL returns false It always prints out an unnecessary error message in the console log. Below is the error message I receive.
-canOpenURL: failed for URL: "XXXX://XXXXXXXXXXXXX" - error: "The operation couldn’t be completed. (OSStatus error -10814.)
As I am using multiple schemes in my application, and my customer does not want these error message logs. Is there any way I can avoid printing these warning/log message to console.
This is the radar link(similar issue). Its closed without any solution.
Currently I am using iOS 11.
Any help will be appreciated.
Seems an intended syslog by Apple mentioned in their WWDC presentation
https://developer.apple.com/videos/play/wwdc2015/703/?time=576
This does not print to device log. As its printing only in the debug area, we can ignore it.

Error launching 'Watchkit extension" - SPErrorUnknownMessage

Trying to run Watchkit - Notification. Receiving the following error:
Error launching 'Watchkit extension" - SPErrorUnknownMessage
Has anybody else come across this error before or knows what it means? Haven't been able to find anything online about it.
Cheers,
A
I have seen this issue and it was related to an error in the structure of my .apns file - there was a comma missing in the json. Once this was corrected, notifications worked again.
Try looking for errors in the Payload apns file that you are using for this target.
I got this message when I removed the file PushNotificationPayload.apns from the WatchKit Extension in Xcode.
Take a look into the Run-Section the Schema: If the Watch Interface entry shows something like Dynamic/Static Notification, it will likely expect some apns-file as notification payload. If that file is missing (or faulty as for Gavin Potts), you'll get that error.
So either fix the apns file, or change the Watch Interface entry to Main or sth. else.
This error occurs due to PushNotificationPayload.apns. Sometime closing quote may be missing.

Do I need to have an apple Developer ID to use HomeKit framework?

Hi I'm trying to add a home to the database, but i get an error.
[self.homeManager addHomeWithName:#"Enfield" completionHandler:^(HMHome *home, NSError *error)
{
if (error != nil) {
NSLog(#"Unable to add home. \n%#", error);
} else {
NSLog(#"Home added Sucessfully \n%#", home);
}
}];
I get an error:
Error Domain=NSCocoaErrorDomain Code=4097 "The operation couldn’t be completed. (Cocoa error 4097.)" (connection to service named com.apple.homed.xpc) UserInfo=0x7f9e9b965290 {NSDebugDescription=connection to service named com.apple.homed.xpc}
I looked in other posts and it looks like you have to have Developer ID, but that just doesn't make sense Apple allows to develop everything without an ID, but not the HomeKit. Can someone please shed a light on this.
EDIT:
GitHub link https://github.com/zlDev/HomeKitDemo
NinjaEDIT: Some code
To see if you got an error, don't test error. Instead, the test should be
if (home == nil) {
If there is an error, then error points to a description of the error; if there was not an error, error may be nil or may point to garbage.
OK, I dug a little deeper.
The error connection to service named com.apple.homed.xpc means that Xcode cannot connect to the HomeKit Accessory Simulator, which it would normally do through the Mach port named com.apple.homed.xpc. (The .xpc is the clue that this is for program-to-program commnunication. It's not a URL.)
The HomeKit documentation says that to start the HK Simulator, you need to add HomeKit to the list of your project's capabilities, and then use the menu command Xcode→Open Developer Tool→HomeKit Accessory Simulator. When I created a dummy iOS project and tried to add the HomeKit capability, Xcode at first refused because I had not yet agreed to Apple's latest terms of service.
Which answers your question. You cannot turn on the HomeKit capability without an Apple Developer ID.
What it doesn't answer is whether the developer ID has to be a paid developer ID. It might suffice to set up a free developer ID. That gives Apple a mechanism to get your agreement to Apple's terms of service, and might be all they need for now.
But even after I finally got the HomeKit capability turned on, the menu command was not available. Apparently you need to also go to developer.apple.com/downloads and download "Hardware IO Tools for Xcode 6.1", which includes the HomeKit Accessory Simulator". You will need an Apple Developer ID (of some level) to download the file.

I can't get HealthKit to work. Missing Entitlement

I am having a hard time to get HealthKit working for my iOS App. I have done all the steps I have found so far and none seem to solve my problem I keep getting this error when trying to authorize Healthkit:
Error Domain=com.apple.healthkit Code=4 "Missing com.apple.developer.healthkit entitlement." UserInfo=0x78fa24e0 {NSLocalizedDescription=Missing com.apple.developer.healthkit entitlement.}
Here is my code asking for authorization:
if([HKHealthStore isHealthDataAvailable]) {
self.healthStore = [[HKHealthStore alloc] init];
[self.healthStore requestAuthorizationToShareTypes:nil readTypes:[self dataTypesToRead] completion:^(BOOL success, NSError *error) {
if (!success) {
NSLog(#"HK Error: %#", error);
[self presentHealthAlert:#"You didn't allow APP to access HealthKit Data. Please go to Settings and set up APP permissions." withTitle:#"Error"];
} else {
[self presentHealthAlert:#"Thank You For Access" withTitle:#"Success"];
}
}];
} else {
[self presentHealthAlert:#"Health Data Not Available" withTitle:#"Success"];
}
And Yes, I have enabled it on my project Capabilites, and yes I have enabled it in my Dev Center App ID. Is there anything else I might be missing?
I had this problem with a watchOS 2 app. The resolution was to ensure I had enabled the HealthKit entitlement for both the iOS app and the watch extension.
I had wrongly assumed the switch for the iOS app would be inherited by the watch extension.
You have to make sure that you click on your program on the left side of Xcode (the top of your file hierarchy). You'll come to a general settings screen in the main window (to the right) where you will see your bundle identifier, deployment target, and additional settings. Click on the tab at the top that says Capabilities. Now you will see a toggleable list which includes HealthKit. You have to activate it here before you can use it in the app.
Edit: Here is an image from Xcode that might help you find this if you're not familiar with setting dependencies or other program specific settings.
It is in this list on the right, towards the bottom you'll see HealthKit. It will check several things once you toggle it on and verify that you can use it.
A bit old, but for anyone else who has issues, I had to manually refresh my provisioning profiles as well in XCode 6.2 (Preferences -> Accounts).
I ended up here after reaching my wit's end. Nothing worked and I clearly had the HealthKit entitlement enabled so finally I just restarted the phone. Voilà. Restarting cleared the missing entitlement errors.
Click on the Watch App Extension target.
Tap on the Capabilities.
Scroll down to the bottom and turn on the HealthKit.
I managed to get my entitlement working by ensuring that I had a device registered. Once I got my iPhone showing under the simulator and I didnt have any unresolved issues under the identity section of the app it all loaded ok.
You may find that although you have turned on the HealthKit entitlement on in xcode that there is a second entitlements file that does not contain the healthkit boolean. I found that while the obvious entitlements file (at the top level) had the correct information, a different entitlements file had been created under Resources that did not contain the healthkit entitlement. fixing that file fixed my problem.

Resources