neden olur Aşağıdaki kod var:Tip dönüşümü bir ARC ortamında derleyici hatası
NSInvocation* invocation = [NSInvocation invocationWithMethodSignature:signature];
[invocation setTarget:delegate];
[invocation setSelector:@selector(restClient:loadedFile:contentType:eTag:)];
// Error Here!
[invocation setArgument:&self atIndex:2];
[invocation setArgument:&filename atIndex:3];
[invocation setArgument:&contentType atIndex:4];
[invocation setArgument:&eTag atIndex:5];
indeksi 2 (&self
) için bağımsız değişken ayarı aşağıdaki derleyici hata neden olur:
Sending *const __strong * to parameter of type void * changes retain/release properties
Geçerli kodu tutarken bunu nasıl düzeltebilirim bilmiyorum. Şu anda sadece NULL
'a yapışıyor ve bir try/catch bloğunda invoke ifadesini sarmalamaktayım, ama bu ideal bir çözüm değil.
Benzer bir mesele, herkes de bunu ele almak nezaketini olurdu: (MPOAuth kütüphanesinden) Bu kod satırı
status = SecItemCopyMatching((__bridge CFDictionaryRef)searchDictionary, (CFTypeRef *)&attributesDictionary);
aşağıdaki hatayı alıyorum ile
Cast of an indirect pointer to an Objective-C pointer to 'CFTypeRef ' (aka 'const void *') is disallowed with ARC
Burada bir blok yerine NSInvocation kullanmak istediğiniz belirli bir neden var mı? – NSResponder
Emin değilim, bu Dropbox SDK'sının bir parçası. Ben sadece ARC-uyumlu hale getirerek, kodu çok fazla karıştırmamaya çalışıyorum. – FeifanZ