loadAppContextDataFromInbox error loading in application context from inbox NSFileReadNoPermissionError -> EACCES - ios

I have been developing an app the works with the apple watch's workouts and an iPhone. The app is written in swift and communication has been working properly for weeks while I add features. I am suddenly getting the following error code when I try to run my app on my iPhone.
[WCFileStorage loadAppContextDataFromInbox] error loading in application context from inbox NSFileReadNoPermissionError -> EACCES
This error is being generated on a program that was working fine using the same code. I believe the error is coming from the following line of code:
WCSession.default.updateApplicationContext(dictionary)
in the func shown below.
func sendAppStateToWatch(appState : String?) {
if WCSession.isSupported() {
if let appStatus = appState {
do {
let dictionary = ["iOSAppState" : appStatus]
try WCSession.default.updateApplicationContext(dictionary)
} catch {
print("sendActiveTimeToPhone() ERROR: \(error)")
}
}
}
}
This function has been working without problem for at least a month. Suddenly, I am getting the error shown above. I have rebooted the watch, phone and Xcode without effect. I suspect the error comes from some privacy setting on the phone or watch that flipped, but looking around I cannot find the problem. Any help is appreciated.

Related

INUIAddVoiceShortcutButton doesn't work if Shortcuts App is deleted

I had added a INUIAddVoiceShortcutButton which works fine, but when I delete the Shortcuts App it stops working. The delegates still return that the shortcut was successful, but the button doesn't change to reflect that the shortcut was added. I found that I have to re-install the Shortcuts app AND restart my phone to return function.
Is there a way to determine if the Ahortcuts app is install? Is there something missing?
I also tested this with Apple's demo Soup Chef app.
The best I've found is calling INVoiceShortcutCenter.shared.getAllVoiceShortcuts returns an error:
Optional(
Error Domain=IntentsErrorDomain
Code=7001 "Failed to get voice shortcuts"
UserInfo={
NSDebugDescription=Failed to get voice shortcuts,
NSUnderlyingError=0x283c42910
{
Error Domain=VCVoiceShortcutsErrorDomain
Code=1004
"Shortcuts app is not installed"
UserInfo={NSLocalizedFailureReason=Shortcuts app is not installed
}
}}
)
And after adding the shortcut it returns nil:
func addVoiceShortcutViewController(_ controller: INUIAddVoiceShortcutViewController, didFinishWith voiceShortcut: INVoiceShortcut?, error: Error?) {
INVoiceShortcutCenter.shared.getVoiceShortcut(with: voiceShortcut!.identifier) { (shortcut, error) in
print("\(String(describing: shortcut))") // nil
print("\(error.debugDescription)") // nil
}
}

How to call `beginRequest` of Call Directory Extension?

I have to test about Call Blocking & Identification. So I followed the steps below.
(1) Create a Call Directory Extension in my project from [File] > [New] > [Target].
(2) Add a logging in Call Directory Extension to test.
class CallDirectoryHandler: CXCallDirectoryProvider {
override func beginRequest(with context: CXCallDirectoryExtensionContext) {
print("test")
}
}
(3) Call reload function of CallKit on my project.
CXCallDirectoryManager.sharedInstance.reloadExtension(withIdentifier: "EXTENSION_BUNDLE_IDENTIFIER", completionHandler: { (error) in
if let error = error {
print(error.localizedDescription)
} else {
print("success")
}
})
(4) Check my app is enabled in Settings > Phone > Call blocking & identification.
And success of 3 is printed, but test of 2 isn't printed.
Is there anything I should check?
Thanks in advance.
I think it is being called correctly as you can check the response on your app target sandbox.
The only way I know to get access to the logs in this case is by going in the Devices window of Xcode and looking at the device console, you should be able to see logs like this:
com.apple.CallKit.CallDirectory: ...
You might also try to debug it by putting directly a breakpoint in this line:
print("test")
Check also tutorials on finding out if you have any issue in the setup between your extension and your app sandboxes, there is a good one here: https://pusher.com/tutorials/callkit-ios-part-1

iOS: GooglePlaces API error

I am getting this error when trying to use the sample code from Google Places getting started Link
Error: Current Place error: The operation couldn’t be completed. An internal error occurred in the Places API library.
I am calling this function on viewDidLoad. I also created a IBAction with this code to make sure it wasn't a timing issue. I got the same error this way as well.
placesClient.currentPlace { (placeLikelihoods, error) in
guard error == nil else {
print("Current Place error: \(error!.localizedDescription)")
return
}
if let placeLikelihoods = placeLikelihoods {
for likelihood in placeLikelihoods.likelihoods {
let place = likelihood.place
print(place.name)
}
}
}
I have created a new project in Firebase, which created a new project in Google Dev Console. I created new API Key, Enabled Google Maps and Google Places API. I added CoreLocation framework, my pods are up to date. I should not be hitting any limits as it is just me learning. I have the Location When In Use set up i the Plist - user gets the dialog on fresh install. I accepted it. I added location manager code from here to make sure I am getting the location. I signed up for Apple developer to get the app on my device just in case the location wasn't staying on the simulator. I have a feeling this is something stupid. Please let me know any ideas to get passed this. Thanks!

Parse - callFunctionInBackground crashes app on [__NSTaggedDate UTF8String] - But did not when I submitted my app

I'm using a Parse Cloud function to get a list of movies. This was all working very well till today. The app crashes and I can't seem to fix it.
Weird (and highly problematic) thing is that it did work yesterday and the days before. (This app is in production in the App store)
This is the function causing the error:
PFCloud.callFunctionInBackground(function, withParameters: parameters) { (movies, error) -> Void in
if error != nil { return block(success: false, movies: []) }
PFObject.pinAllInBackground(movies as! [PFObject])
let foundMovies = ParseMovie.arrayFromPFObjects(movies as! [PFObject])
return block(success: true, movies: foundMovies)
}
If I comment the 4 lines inside the block, it still crashes. If I comment the entire function, it doesn't. So it seems as soon as I call "PFCloud.callFunction" the app crashes.
Any idea what can go wrong? The Parse cloud function does work, because calling it with the parse rest API gives me the movies as expected.
Any help is appreciated, thanks!
Ok, got it. Apparently I'm using an old version of the Parse SDK (1.5) and since today, this version is not working anymore.. I'm not using pods so I was not aware of this out-dated version. A bit disappointed, but probably my fault?

Google Places Callback not being called in Swift iOS

I am using the GoogleMaps SDK (maps & places). For some reason the following callback is not being called. I have put loggers in there but nothing happens.
var placesClient : GMSPlacesClient?
...
func run(){
self.placesClient?.currentPlaceWithCallback({ (list: GMSPlaceLikelihoodList?, error: NSError?) -> Void in
if let error = error {
println("error: \(error.description)")
return
}
if let list = list {
self.renderList(list)
}
})
}
For some reason the block in currentPlaceWithCallback does not get called. Yesterday it happened because my API had a wrong bundle identifier, after changing which it started working. But today it stopped.
Any idea why this would happen ? Also, are we exposed to any API logs by Google ?
I was getting the same issue on my iPhone 6 device AND iPhone 6 simulator.
The fix was to add the NSLocationWhenInUseUsageDescription permission in Info.plist! But, it worked only on my iPhone 6 device, NOT the simulator.
As mentioned in the Google Place Guide:
(https://developers.google.com/places/ios-api/start)
Please note, as this sample requires access to the location of the device to get the current location, you will need to set the NSLocationWhenInUseUsageDescription key with appropriate explanatory text in your project's Info.plist file. For more details, see the guide to getting current place.
Now, the way I got it working on the iPhone simulator was by changing my location on the Simulator: Debug -> Location. That is, it was set to 'Apple' by default, I just changed it to Bicycle Ride.
It worked for me, may not for all.

Resources