I added Message Archiving for XMPP chat im my app.
After that, my app crashes when I send/receive message in XMPP chat. App crashes only when I run it on device without connect to laptop (xcode). When I debug the app in xcode, there are no crashes.
I connected all necessary XMPP classes and directories to my project.
I setup XMPPMessageArchivingCoreDataStorage and XMPPMessageArchiving instances:
xmppMessageArchivingStorage = [XMPPMessageArchivingCoreDataStorage sharedInstance];
xmppMessageArchivingModule = [[XMPPMessageArchiving alloc] initWithMessageArchivingStorage:xmppMessageArchivingStorage];
[xmppMessageArchivingModule setClientSideMessageArchivingOnly:YES];
I activate XMPPMessageArchiving instance:
[xmppMessageArchivingModule activate:xmppStream];
and add delegate:
[xmppMessageArchivingModule addDelegate:self delegateQueue:dispatch_get_main_queue()];
Also, I do:
[xmppMessageArchivingModule removeDelegate:self];
[xmppMessageArchivingModule deactivate];
xmppMessageArchivingModule = nil;
xmppMessageArchivingStorage = nil;
What it the reason of crashes?
Resolved:
add compile flag
-fobjc-arc
to XMPPMessageArchivingCoreDataStorage.m and XMPPMessageArchiving.m
how to add flag is here how to add ARC in between of project
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.