Put the apples, onions, preserved lemons, raisins, garlic and vinegar in a large heavy based saucepan and bring to the boil. Reduce the heat and simmer for 20 minutes until the apples are soft but not broken up.
Stir in the treacle and simmer for 45 minutes until the liquid has reduced and you have a chutney like consistency.
Stir in the salt and spices and continue heating for another 2 minutes until everything is mixed in well, Take off the heat and decant into the prepared jars.
Store in a cool dry place until opened then keep in the refrigerator. It will keep for up to three months.