The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

Here's my setup:

  • Ultralite iOS remote DB's running latest SQL Anywhere 12.0.1
  • Mobilink Server to MS Sql Consolidated Synchronization
  • Remote tables use "uniqueidentifier" for PK's to manage sync

The problem after years of this setup is that yesterday out of the blue I had a GUID clash on one of my tables on the "uniqueidentifier" column at the consolidated DB after an attempted Update-Insert from the remote. Then this morning I had another GUID clash. So now i'm starting to freak out.

My users have started to upgrade to iOS 7. Is there an issue in the way "NEWID()" is called under iOS 7? Or for what other reason could I get identical "GUID's" on 2 separate devices 1 day apart? Any help is appreciated. Thanks!

asked 24 Sep '13, 09:13

Jason's gravatar image

accept rate: 0%

edited 24 Sep '13, 15:25

Volker%20Barth's gravatar image

Volker Barth

One additional note. The 2 GUID's that clashed are as follows:



Please notice that these GUIDS were generated from separate devices. But are looking very similar. Thanks again.

(24 Sep '13, 09:15) Jason
Comment Text Removed
Comment Text Removed

I assume these colliding GUIDs are all recently generated on iOS 7. It indeed appears that iOS 7 has broken UltraLite's code to determine the device identifier portion. This will be fixed. In the meantime we need a workaround.

Note: this defect should only affect version 12 on iOS 7. Version 16 uses an updated method for GUID generation.

I think the best immediate workaround is to explicitly insert GUIDs (as you've already wisely concluded ;) in place of NEWID() and NEWID defaults.

In addition to NSUUID, you could use CoreFoundation as follows:

UL_DECL_BINARY( 16 ) bin;
CFUUIDRef uuid = CFUUIDCreate( kCFAllocatorDefault );
CFUUIDBytes rawbytes = CFUUIDGetUUIDBytes( uuid );
memcpy(, &rawbytes, 16 );
bin.len = 16;
CFRelease( uuid );
prepstmt->SetParameterBinary( col, (ul_binary *)&bin );

Note that the binary representation can be inserted directly if you use the ul_binary type. This is slightly more efficient if that's a concern. uuid_generate() is also available.

permanent link

answered 24 Sep '13, 10:59

Tim%20McClements's gravatar image

Tim McClements
accept rate: 34%

edited 24 Sep '13, 15:55

Thanks Tim,

I did just confirm that the ID's are coming from iOS 7. I'm in the process of manually iterating any inserts that use "NEWID()" with the iOS GUID generator for iOS 6+:

NSString *uuid = [[NSUUID UUID] UUIDString];

Please keep us posted on a workaround for the DB generated UUID or when and EBF can be released. Thanks!

(24 Sep '13, 11:04) Jason
Replies hidden

I think you're on the right track for now! Slight alternatives listed above.

(24 Sep '13, 15:57) Tim McClements

A fix has been submitted for this, available in and later. I'm not sure when the EBF will be released.

(24 Sep '13, 16:32) Tim McClements
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 24 Sep '13, 09:13

question was seen: 789 times

last updated: 24 Sep '13, 16:32