The issue is when you have two different object stores in the same indexeddb, primary key values appear to be \"shared\" across all stores.
I can confirm that iOS8 is definitely buggy here. I tried a few workarounds, but the best I can suggest is a primary key that combines some unique string, like the name of the objectStore, with a number. So for example, given two objectStores called people and notes, I'd store data with keys like so:
people/X notes/X
You can set X manually, or, use the .count() method on the objectStore to find the count and add one. Here is an example:
//Define a person
var person = {
name:"Ray",
created:new Date().toString(),
}
//Perform the add
db.transaction(["people"],"readwrite").objectStore("people").count().onsuccess = function(event) {
var total = event.target.result;
console.log(total);
person.id = "person/" + (total+1);
var request = db.transaction(["people"],"readwrite").objectStore("people").add(person);
request.onerror = function(e) {
console.log("Error",e.target.error.name);
//some type of error handler
}
request.onsuccess = function(e) {
console.log("Woot! Did it");
}
}
Note that I specified keyPath of "id" for this OS.