Based on your provided code, this is the correct way to create a singleton object.
In such, here's a reference link from Matt Gallow's site showing the same singleton setup as you're doing.
However, there is not enough information provided to determine the cause of your performance issues (whether or not caused by accessing the database). In general, writing efficient database code is hard, which is why Core Data
exists.
You might consider looking into Core Data
to see if this will work better for your app or perhaps creating a question on StackOverflow StackOverflow describing the issue you're seeing in more detail and asking for help on how to implement what you're trying to do.
Based on your provided code, this is the correct way to create a singleton object.
In such, here's a reference link from Matt Gallow's site showing the same singleton setup as you're doing.
However, there is not enough information provided to determine the cause of your performance issues (whether or not caused by accessing the database). In general, writing efficient database code is hard, which is why Core Data
exists.
You might consider looking into Core Data
to see if this will work better for your app or perhaps creating a question on StackOverflow describing the issue you're seeing in more detail and asking for help on how to implement what you're trying to do.
Based on your provided code, this is the correct way to create a singleton object.
In such, here's a reference link from Matt Gallow's site showing the same singleton setup as you're doing.
However, there is not enough information provided to determine the cause of your performance issues (whether or not caused by accessing the database). In general, writing efficient database code is hard, which is why Core Data
exists.
You might consider looking into Core Data
to see if this will work better for your app or perhaps creating a question on StackOverflow describing the issue you're seeing in more detail and asking for help on how to implement what you're trying to do.
Based on your provided code, this is the correct way to create a singleton object.
In such, here's a reference link from Matt Gallow's site showing the same singleton setup as you're doing.
However, there is not enough information provided to determine the cause of your performance issues (whether or not caused by accessing the database). In general, writing efficient database code is hard, which is why Core Data
exists.
You might consider looking into Core Data
to see if this will work better for your app or perhaps creating a question on StackOverflow describing the issue you're seeing in more detail and asking for help on how to implement what you're trying to do.