Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update iOS documentation Troubleshooting #1029

Closed
isgroup opened this issue Feb 23, 2021 · 2 comments
Closed

Update iOS documentation Troubleshooting #1029

isgroup opened this issue Feb 23, 2021 · 2 comments

Comments

@isgroup
Copy link

isgroup commented Feb 23, 2021

Hi there!

First your product rocks, thanks :)

This is not an issue, just an advice for advanced troubleshooting on iOS devices.

Long story short: I just bought an iPhone 12 and configured the two CardDAV and CalDAV accounts in Settings. Given the fact that you set up the .well-known discovery mechanism no problem here. Contacts starts to sync but then the count was off by a thousand.

Why? Well it turns out that one of the VCARDS had some control char in it (visible by getting the vcard using curl on the terminal) and iOS would just stop there and continue requesting the same addressbook-multiget contacts instead of skipping it.

The hypothesis was that one of the .vcf in the addressbook-multiget was the problem (it turned out that this was correct) so I debugged it and I'm sharing how I did it for the posterity.

Edit dav.php

Add the following code after the comments block.

file_put_contents('/tmp/foo.txt', print_r(array(
        $_SERVER['REQUEST_URI'],
        $_SERVER['QUERY_STRING'],
        $_SERVER['REQUEST_METHOD'],
        $_SERVER['REMOTE_ADDR'],
        $_SERVER['HTTP_USER_AGENT']
), TRUE)."\n\n".file_get_contents('php://input')."\n-----------------------------------------------\n\n", FILE_APPEND);

Monitor the requests iOS makes

tail -f ../tmp/foo.txt ../../log/error.log ../../log/access.log

Find the anomaly

You will notice the same addressbook-multiget request over and over. This was my case, yours may differ.

Array
(
    [0] => /XXXX/dav.php/addressbooks/XXXX/default/
    [1] => 
    [2] => REPORT
    [3] => XXXX
    [4] => iOS/XXXX (XXXX) dataaccessd/1.0
)


<?xml version="1.0" encoding="UTF-8"?>
<D:addressbook-multiget xmlns:D="urn:ietf:params:xml:ns:carddav">
  <A:prop xmlns:A="DAV:">
    <A:getetag/>
    <D:address-data/>
  </A:prop>
[DAV ENTRIES HERE, COPY THEM IN A /tmp/foo FILE ON YOUR PC]

Fetch them

Horrible, I know :)

cat /tmp/foo  | cut -d "\"" -f3 | cut -d ">" -f2 | cut -d "<" -f1 | while read aa; do echo "$aa\n"; curl --digest -s "https://XXXX:XXXX@XXXX/$aa"; echo -en "\n\n\n"; done | less

Hopefully you will spot the offender entry.

Delete the VCF

curl --digest -X DELETE https://XXXX:XXXX@XXXX/dav/dav.php/addressbooks/XXXX/default/XXXX.vcf

Now your iOS will sync all the entries and will upload changes.

This is a really important part of the analysis: until when iOS has synced all the contacts, it will not upload/sync changes, you will see the changes only locally. So if your iOS is not syncing and you believe that it's a Baikal issue, it could not be, and the Contacts app is just in a stale status without giving any clue!

Thanks and i hope this saves some lives :)

@ByteHamster
Copy link
Member

Thanks for the detailed explanation! How about creating a wiki page with your guide?

@eiswurm
Copy link

eiswurm commented Oct 7, 2021

same here. iOS has stopped syncing contacts. I simply exported all contacts in the client (emClient) as VCARD, then deleted and re-imported. Also helped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants