in Xcode 7.2.1 I have an issue when I archive my project, my app using WebSocket and I'm using the CocoaAsyncSocket Library, the app runs on Simulator or Any device but when archive, xcode show me this errors warnings:
in the class GCDAsyncUdpSocket in the method:
- (void)getDelegate:(id <GCDAsyncUdpSocketDelegate>*)delegatePtr delegateQueue:(dispatch_queue_t *)delegateQueuePtr;
warnings error:
/Users/Dennis/Desktop/WebSocketDennis/CocoaAsyncSocket/Source/GCD/GCDAsyncUdpSocket.m:569:56: Method parameter of type '__autoreleasing id<GCDAsyncUdpSocketDelegate> *' with no explicit ownership
and
/Users/Dennis/Desktop/WebSocketDennis/CocoaAsyncSocket/Source/GCD/GCDAsyncUdpSocket.m:569:102: Method parameter of type '__autoreleasing dispatch_queue_t *' (aka 'NSObject<OS_dispatch_queue> *__autoreleasing *') with no explicit ownership
I did try another answers like in:
question 1, question 2 or question 3
but how can I fix this ARC issue if I need an id delegate or dispatch_queue_t
and why this issue appears only when needed archive the project?
EDIT 1 someone have any idea for how ARC handles returns by indirection in this case? becocuse the errors warning show only in the methods:
.h file:
- (void)getDelegate:(id <GCDAsyncUdpSocketDelegate>*)delegatePtr delegateQueue:(dispatch_queue_t *)delegateQueuePtr;
- (void)setDelegate:(id <GCDAsyncUdpSocketDelegate>)delegate delegateQueue:(dispatch_queue_t)delegateQueue;
in .m file:
- (void)getDelegate:(id <GCDAsyncUdpSocketDelegate> * )delegatePtr delegateQueue:(dispatch_queue_t *)delegateQueuePtr
{
if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey))
{
if (delegatePtr) *delegatePtr = delegate;
if (delegateQueuePtr) *delegateQueuePtr = delegateQueue;
}
else
{
__block id dPtr = NULL;
__block dispatch_queue_t dqPtr = NULL;
dispatch_sync(socketQueue, ^{
dPtr = delegate;
dqPtr = delegateQueue;
});
if (delegatePtr) *delegatePtr = dPtr;
if (delegateQueuePtr) *delegateQueuePtr = dqPtr;
}
}
- (void)setDelegate:(id <GCDAsyncUdpSocketDelegate>)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue synchronously:(BOOL)synchronously
{
dispatch_block_t block = ^{
delegate = newDelegate;
#if !OS_OBJECT_USE_OBJC
if (delegateQueue) dispatch_release(delegateQueue);
if (newDelegateQueue) dispatch_retain(newDelegateQueue);
#endif
delegateQueue = newDelegateQueue;
};
if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) {
block();
}
else {
if (synchronously)
dispatch_sync(socketQueue, block);
else
dispatch_async(socketQueue, block);
}
}
- (void)setDelegate:(id <GCDAsyncUdpSocketDelegate>)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue
{
[self setDelegate:newDelegate delegateQueue:newDelegateQueue synchronously:NO];
}
- (void)synchronouslySetDelegate:(id <GCDAsyncUdpSocketDelegate>)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue
{
[self setDelegate:newDelegate delegateQueue:newDelegateQueue synchronously:YES];
}
I can run the project on iOS simulator and any real device, the problem is only when I want archive the project, if I do Product>Analyze or Product>Build For> Running or Testing, runs perfectly, but when I do Product>Archive or Product> Build For>Profiling the error warning appears
thanks!