Realm Error Summary in iOS Han Junqiang blog

Source: Internet
Author: User

Daily Update Attention :http://weibo.com/hanjunqiang Sina Weibo!

I. Error message: Attempting to modify object outside of a write Transaction-call beginwritetransaction in an RLMRealm instance Fir St. Attempts to modify an object outside of a write transaction should first be called before the Rlmrealm instance object beginwritetransaction

Code section:

Managementcamviewcontroller *manager = [[Managementcamviewcontroller alloc] init];? Manager.ipcammodel = Curnode.nodedata;? Curnode.nodedata; [Curnode.nodedata copy];? [Self.navigationcontroller Pushviewcontroller:manager animated:yes];</span>

when I push from one page to another, I find that the data is not changed to a direct assignment when I copy it. (This strange problem has not been solved) The original copy is not a problem? However, instead of directly assigning the value, the above error is reported.

Two. Error message: Realm accessed from incorrect thread realm access from wrong threads

Solve:

[[RLMRealm Defaultrealm] beginwritetransaction];? _ipcammodel.cacheimgpath = spath;? [[RLMRealm Defaultrealm] Commitwritetransaction];</span>


It's useless to write a single case directly so save it suddenly found this thing really good
You might want to do this without blocking threads. OK, you can do the following.

RLMRealm *realm = [RLMRealm Defaultrealm];? [Realm Transactionwithblock:^{?_ipcammodel.cacheimgpath = spath;?}]; </span>

And one more time, it's because we've got a gcd on the outside .

Dispatch_barrier_async (_concurrentqueue, ^{});</span>

The realm database can not be opened with Realmbrowser when the emulator is running, as if it were open and could not run the program in the Run emulator? This stupid mistake is not the only one I've ever made.


iOS developer Chat QQ Group: 446310206


Daily Update Attention :http://weibo.com/hanjunqiang Sina Weibo!

Realm Error Summary in iOS Han Junqiang blog

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.