Strange SyncServices / iSync console messages when saving ABAddressBook - objective-c

I'm displaying and editing an ABPerson with an ABPersonView. I do this like so:
ABPerson *person = (ABPerson *)[_addressBook recordForUniqueId:[curDict valueForKey:#"id"]];
[_personView setPerson:person];
[_personView setEditing:YES];
Where _personView is my ABPersonView. When I edit the ABPerson with the ABPersonView and I save the AddressBook:
[ABAddressBook addressBook] save];
It does save and in the AddressBook application I can see its value has changed, but I get these error messages in Xcode and Console:
I first get this:
sandboxd: ([3082]) AddressBookSync(3082) deny file-read-data /Users/xcodeuser/Library/Developer/Xcode/DerivedData/CompanyName-asdxadsafadfqmwqxaagdsfgafguge/Build/Products/Debug
Followed by a lot of this:
sandboxd: ([3035]) AddressBookSync(3035) deny mach-lookup com.apple.syncservices.SyncServer
And it ends with this:
AddressBookSync[3035:707] [0x10011ba50] |ISyncManager|Warning| SyncServer is unavailable: timed out trying to connect
AddressBookSync[3035:707] AddressBookSync (client id: com.apple.AddressBook) error: Exception running AddressBookSync: Timed out waiting for the sync server
AddressBookSync exited with 2
My application is sandboxed and I integrated iCloud.
I have searched but could not find anyone having the same kind of problems, I have tried this:
Using [[ABAddressBook] sharedAddressBook] instead of [[ABAddressBook] addressBook] but I then get an error from the ABPersonView saying the use of sharedAddressBook is deprecated with the ABPersonView.
I added SyncServices framework, didn't help
The code does work though, at least with my iCloud account. Anyone got a clue to why I'm getting these errors? Is it worth a shot trying it with Xcode 4.3 and 10.8? I'm currently running 4.2.1 with Lion.
Thanks!

I've seen exactly this same problem. I believe you are seeing a bug in the Apple frameework.

Related

Reasons behind Cocoa error code NSFileWriteUnknownError

We are developing a document-based Objective-C project, using NSPersistentDocument and NSPersistentStore to save a unique binary file on disk. No autosave.
One customer has a recurring saving issue
The document "something.extension" could not be saved
that we cannot reproduce in our development setup. They can load their saved file without issue, but after a few changes the error pops up when trying to save. In our own setup, using the same build, the file opens and saves without issue.
The error is too vague for us to pinpoint the exact reason why their document would not save, but based on the very basic error message, we have realised the error raised is NSFileWriteUnknownError = 512.
In which situation would that error be raised? In which situation wouldn't the other, more specific error codes be applicable?
We build using SDK 10.14 and both us and the customer run on macOS Monterey 12.3.1
EDITED ON 09/08/22 - Added details based on Willeke's comments.
EDITED ON 17/08/22 - Underlying error
The error's userInfo comes with an underlying error message, which our customer could display. It states "No known persistent store for URL"

How do I access logs from the past day with os_log from Apple Watch?

I'm trying to troubleshoot an issue on watchOS.
I'm not sure how to reproduce the problem I'm seeing, but I do encounter it occasionally during testing on a real device in the wild, so I'm trying to use os_log in order to diagnose the problem after the fact.
As a first step, to make sure I understand how how to write to the log and access it later, I've attempted to log an event any time the app first loads.
In the ExtensionDelegate.swift file for my app, I added this:
import os.log
extension OSLog {
private static var subsystem = Bundle.main.bundleIdentifier!
static let health = OSLog(subsystem: subsystem,
category: "health")
}
Then, I updated the applicationDidBecomeActive delegate function with this:
func applicationDidBecomeActive() {
os_log("App Started",
log: OSLog.health,
type: .error)
}
I know it's not really an error message, but from what I've read, messages that are not .error are not written to saved to the log for later. I want to make sure it gets written to the log like a real error would.
I installed the sysdiagnose profile, then installed the the most recent version of my app.
After testing the app for the day, I attempted to export the file. Following the instructions I've found elsewhere, I produced a sysdiagnose on Apple Watch by holding the Digital Crown and Side button for two seconds (and felt the haptic feedback when I released).
Then, I put the watch on the charger for a few minutes per the instructions here, which recommended 15 minutes.
I opened the Watch app on my paired iPhone, then went to General > Diagnostic Logs and downloaded the sysdiagnose from Apple Watch, and sent it to my computer with AirDrop.
This gave me a tarball file (for example, sysdiagnose_2021.03.05_17-01-57-0700_Watch-OS_Watch_18S801.tar.gz). Once I decompressed that, I had a folder of lots of files and subfolders.
After poking around in this folder, I figured my best bet was to look in the system_logs.logarchive file. I opened that in the macOS Console app, set the Showing dropdown to All Messages, and looked around the time I opened the app. I didn't see any log output from my app.
I also filtered for "App Started" (the log message from my app) and didn't find anything.
Then, I filtered by category for "health" and didn't find the event I had logged.
Is system_logs.logarchive the correct place to be looking for the log output from my app?
If not, where should I be looking? Or what am I doing wrong?
I really want a better understanding of how I can log messages on Apple Watch so I can view them later so I can make my Apple Watch apps more robust, but I'm at a dead end.
Am I looking in the wrong place? Or am I setting up the logging wrong? Or is it something else? I would appreciate any guidance about this!
According to the Apple Dev Forms, sysdiagnose allows you to view the logs on your apple watch.

What is: Bad_dump!missing_teb (Windows Phone Dev Center Crash Log)

The following 2 crashes are being reported as our WP 8.1 app's highest occurance crashes based on Window's developer center's crash logs.
Any clue what they mean or how to debug them? I suspect 'out of memory' but would like to confirm.
First:
bad_dump!missing_teb BAD_DUMP_MISSING_MEMORY_MISSING_CLR_METADATA_bad_dump!missing_teb
Second:
bad_dump!missing_teb BAD_DUMP_MISSING_MEMORY_NULL_CLASS_PTR_READ_ZEROED_STACK_MISSING_CLR_METADATA_bad_dump!missing_teb
I've been told by a Microsoft Technical rep that it is a bad dump and you can not retrieve any additional information on it.
He pointed me to the following:
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/d74cc413-3c4b-4a92-9c42-058bc41f503f/wp81-cant-identify-the-reason-for-crash-baddumpmissingteb?forum=winappswithcsharp

Handling iOS 8's Changes To App Containers within Xamarin (alternative to Environment.GetFolderPath)

Per the thread started at (http://forums.xamarin.com/discussion/24860/documents-directory-has-moved-in-ios-8#latest), we are working to adapt our App to the recent changes make in iOS regarding accessing the iOS 8 file structure. We have reviewed and attempted the implementation of the code found within the iOS 8 Note at http://developer.xamarin.com/guides/ios/application_fundamentals/working_with_the_file_system/#Creating_Files_and_Directories, and while the results of the sample code does provide some environment
variables, some additional instructions and how to get the results to behave in the same manner as Environment.GetFolderPath would be helpful – or guidance on whatever the appropriate approach should be.
The following takes place after a Release archive is built and pushed to an iPad device running iOS 8.0 (note not 8.0.1). We are using the following code:
var documents = NSFileManager.DefaultManager.GetUrls
(NSSearchPathDirectory.LibraryDirectory,
NSSearchPathDomain.User)
[0].Path
And we get:
/var/mobile/Containers/Data/Application/8C4D70BC-7607-xxxx-xxxx-A503A061E1EF/Library
But when we try to write to files in this directory, we get the following error in the device log:
Sep 25 12:47:22 Cognilores-iPad kernel[0] <Notice>: Sandbox: SEXI_reader(1243) deny file-write-create /usr/share/CogniLore
Is anyone able to help us identify what is going wrong and what workaround we can use? This is a severe issue – our App crashes immediately after users upgrade to 8.0, and we need to get an updated version into the approval process as soon as possible.
Is anyone able to help us identify what is going wrong
The path you show does not match the path from the device logs. Are you sure they come from the same code ?
e.g. maybe another part of your application later try to access a different directory (and this is what you're seeing in the logs) ?
Some quick test shows that the code (below) works fine on iOS8 devices.
var urls = NSFileManager.DefaultManager.GetUrls (NSSearchPathDirectory.LibraryDirectory, NSSearchPathDomain.User);
var path = urls [0].Path;
File.WriteAllText (Path.Combine (path, "myfile.txt"), "woohoo");

NSNetServiceBrowser did NOT find published service

On an iPhone (the server), I've tried to publish a service and my code ran into the NSNetService object's delegate method:
-(void)netServiceDidPublish:(NSNetService *)sender
So I believe that my service #"_chatty._tcp." has published successfully. Then on another iPhone (the client), I use NSNetServiceBrowser to find my service, but it did NOT run into the delegate method:
-(void)netServiceBrowser:(NSNetServiceBrowser *)netServiceBrowser didFindService:(NSNetService *)netService moreComing:(BOOL)moreServicesComing
I found some questions related to my case on this site, most of the answer remind to check the delegate object whether is out of scope or not. I'm sure my delegate work well because it ran into another delegate method like:
-(void)netServiceBrowserWillSearch:(NSNetServiceBrowser *)aNetServiceBrowser
Can anybody help me find out the reason?
Here are some parts of my code:
I init the service like that:
#define MY_PROTOCOL #"_chatty._tcp."
self.myService = [[NSNetService alloc]
initWithDomain:#"" type:MY_PROTOCOL
name:#"thaith" port:self.port];
The port is initialized with a given listeningSocket in the Browser class:
NSNetServiceBrowser* finder = [[NSNetServiceBrowser alloc] init];
//I also retain the finder.
finder.delegate = self;
[finder searchForServicesOfType:MY_PROTOCOL inDomain:#""];
After having come across the same problem and giving up for a month. I've just come back to it and solved it:
Even though the sample code in the docs seems to imply otherwise, don't use a local variable for the NSNetServiceBrowser. As soon as it goes out of scope it gets garbage collected. Make finder an instance variable or property so its sticks around. I didn't spot this straight away as the netServiceBrowserWillSearch: delegate was getting called so I assumed everything was ok...
Possible Solutions
Check both WiFi identifiers are same
Check both are in same WiFi network
Check the NSNetServiceBrowser delegate assigned as same class
At last download sample Apple.Developer Witap Application , install in two devices , test and confirm it working.
Instead of downloading bonjour browser, I suggest using the terminal command:
dns-sd -B _chatty._tcp local.
For me, it shows that the server side is working fine.
Currently, I can find the service when my application starts, my only issue is that once I stop the server, I get the "removed" event but running it again, I cant discover it anymore. I know the problem is on my client side, thanks to dns-sd - B
I would narrow the scope and try to find the problem place. First, find out whether the service is published correctly. Use Bonjour Browser application (you can find it in the Internet) on a computer within the same local network where you publish the service. I hope you publish and browse in the same local net. If the Bonjour Browser can see your service then you know it is published correctly. Then work on the browser side to connect to it.