cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brijesh (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-11010) Unexpected EOF while finding contacts in iPhone 6s
Date Thu, 23 Feb 2017 05:59:44 GMT

    [ https://issues.apache.org/jira/browse/CB-11010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15879928#comment-15879928
] 

Brijesh commented on CB-11010:
------------------------------

This issue is contacts data related, may not be easy to reproduce. On at least one iphone
I came across phone numbers causing this issue. I was able to resolve with the following change:
Filename: CDVContact.m 
Method name to modify: - (NSDictionary*)toDictionary:(NSDictionary*)withFields

Replace the following:
	value = [self extractMultiValue:kW3ContactPhoneNumbers];
	if (value != nil) {
		[nc setObject:value forKey:kW3ContactPhoneNumbers];
	}

With

	value = [self extractMultiValue:kW3ContactPhoneNumbers];
	if (value != (id)[NSNull null]) {
		NSArray* records = (NSArray*)value;
		int count = (int)[records count];
		for (int i = 0; i < count; i++) {
			NSObject* r = [records objectAtIndex:i];
			NSString* number = [r valueForKey:@"value"];
			NSString* cleanedNumber = [[number componentsSeparatedByCharactersInSet:[[NSCharacterSet
characterSetWithCharactersInString:@"0123456789+"] invertedSet]] componentsJoinedByString:@""];
			[r setValue:cleanedNumber forKey:@"value"];
			[r setValue:@"phone" forKey:@"type"];
		}

		[nc setObject:value forKey:kW3ContactPhoneNumbers];
	}

Brijesh

> Unexpected EOF while finding contacts in iPhone 6s
> --------------------------------------------------
>
>                 Key: CB-11010
>                 URL: https://issues.apache.org/jira/browse/CB-11010
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin Contacts
>    Affects Versions: 2.0.0
>         Environment: iOS 9.2.1, iOS 9.3 in iPhone 6s
>            Reporter: Gowtham
>            Assignee: Vladimir Kotikov
>              Labels: iOS, mustfix, triaged
>
> I tried accessing the contacts using contacts plugin v2.0.1 with the following code 
>     var options      = new ContactFindOptions();
>     options.filter   = "";
>     options.multiple = true;
>     var fields = ["displayName","phoneNumbers"];
>   
>     navigator.contacts.find(fields, gotContacts, errorHandler, options);
> This throws me an SyntaxError: Unexpected EOF in iPhone 6s models.
> I tested the same in iPhone 5s and iPhone 6, this works fine. Also it works fine in iPhone
6s Simulator.
> I tested in three iPhone 6s phones where the iOS is 9.3 for two phones and 9.2.1 for
one.
> All three phones have contacts more than 400.
> All three returned me the same error. 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message