ERROR GCDAsyncUdpSocket: warning 'no explicit ownership' Issue Archive Project XCode

24 views
Skip to first unread message

Dennis Mostajo

unread,
Apr 19, 2016, 8:13:44 PM4/19/16
to CocoaAsyncSocket
Hi everyone:

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:



/Users/
Dennis/Desktop/WebSocketDennis/CocoaAsyncSocket/Source/GCD/GCDAsyncUdpSocket.m:569:56: Method parameter of type '__autoreleasing id<GCDAsyncUdpSocketDelegate> *' with no explicit ownership
/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


in the class GCDAsyncUdpSocket 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; 


.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];
}


so 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?

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

someone have any idea for how ARC handles returns by indirection in this case?

Thank you very much


Reply all
Reply to author
Forward
0 new messages