Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8253025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:43:59+00:00 2026-06-08T00:43:59+00:00

The problem When I attempt to create an ABPerson with ABPersonCreatePeopleInSourceWithVCardRepresentation() using corrupt vCard

  • 0

The problem

When I attempt to create an ABPerson with ABPersonCreatePeopleInSourceWithVCardRepresentation() using corrupt vCard data my app crashes. This is the console output:

2012-07-14 20:20:37.530 vCardTest[4418:707] vCard Syntax Error, character: 7 : /
2012-07-14 20:20:37.531 vCardTest[4418:707] Malformed BEGIN
2012-07-14 20:20:37.534 vCardTest[4418:707] vCard Syntax Error, character: 14 : n
2012-07-14 20:20:37.536 vCardTest[4418:707] Malformed BEGIN
2012-07-14 20:20:37.539 vCardTest[4418:707] vCard Syntax Error, character: 21 : i
2012-07-14 20:20:37.543 vCardTest[4418:707] Malformed BEGIN
2012-07-14 20:20:37.546 vCardTest[4418:707] vCard Syntax Error, character: 28 : o
2012-07-14 20:20:37.548 vCardTest[4418:707] Malformed BEGIN
2012-07-14 20:20:37.550 vCardTest[4418:707] vCard Syntax Error, character: 35 : s
2012-07-14 20:20:37.553 vCardTest[4418:707] Malformed BEGIN
2012-07-14 20:20:37.555 vCardTest[4418:707] vCard Syntax Error, character: 42 : g
2012-07-14 20:20:37.556 vCardTest[4418:707] Malformed BEGIN
2012-07-14 20:20:37.559 vCardTest[4418:707] Malformed BEGIN

What I tried to do to solve it

  • Apple’s docs don’t mention what happens when the data is corrupt.
  • I tried @try and @catch but no exception is really thrown.
  • Since the framework is logging all these syntax errors, I’m sure it knows that something is going on. I just don’t know how to catch that.

Why I care about corrupted data

The input string that generates the vCard comes from different sources which I do not control, so a lot of the times the input data won’t even be a vCard at all. I’m only concerned about parsing valid vCards that’s why it is important to be able to detect non-vCard data and discard it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T00:44:01+00:00Added an answer on June 8, 2026 at 12:44 am

    I faced exactly the same problem, did a lot of research, but couldn’t find any way to catch the exception either.

    Since the errors don’t seem to influence my app, I simply ignore them and check how many valid vCards were found in the scanned data – in my case the vCard comes from a QR code and I expect it to contain exactly one vCard.

    CFArrayRef vCardPeople = ABPersonCreatePeopleInSourceWithVCardRepresentation(defaultSource, scannedVCard);
    
    if(vCardPeople != NULL && CFArrayGetCount(vCardPeople) == 1) {
        // Successfully read one vCard, save it to contacts
        ABRecordRef person = CFArrayGetValueAtIndex(vCardPeople, 0);
        // ...
    }
    else {
        // Display an alert view to inform the user about malformed input data
    }
    

    You said your app crashes – I think this is only indirectly related to the malformed vCard. Maybe it doesn’t crash until a few lines later when your code is not prepared to handle the empty array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my first attempt to create a simple android app using phonegap 1.9.0.
Problem: I am trying to build a recursive tree using a function and data
The problem I'm having is that when I attempt to create a web service
I am using the NetDataContractSerializer. I can create, add and serialize objects into data
I am trying to create 3-tier winform application. Since this is my first attempt
I made my first jQuery plugin attempt, but I have this problem/bug which I
In my attempt to create my own win32 wrapper I have come across this
Occasionally I have a problem when I attempt to update a web reference in
I'm attempt to debug a program I wrote, but I'm running into a problem
I'm working with django-piston to attempt to create an API that supports oAuth. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.