diff --git a/connections/swift/NearbyCoreAdapter/Sources/GNCCoreAdapter.mm b/connections/swift/NearbyCoreAdapter/Sources/GNCCoreAdapter.mm index 8a55cd612a..716424e699 100644 --- a/connections/swift/NearbyCoreAdapter/Sources/GNCCoreAdapter.mm +++ b/connections/swift/NearbyCoreAdapter/Sources/GNCCoreAdapter.mm @@ -278,13 +278,13 @@ - (void)acceptConnectionRequestFromEndpoint:(NSString *)endpointID std::string endpoint_id = [endpointID cStringUsingEncoding:[NSString defaultCStringEncoding]]; PayloadListener listener; - listener.payload_cb = [&delegate](absl::string_view endpoint_id, Payload payload) { + listener.payload_cb = [delegate](absl::string_view endpoint_id, Payload payload) { NSString *endpointID = @(std::string(endpoint_id).c_str()); GNCPayload *gncPayload = [GNCPayload fromCpp:std::move(payload)]; [delegate receivedPayload:gncPayload fromEndpoint:endpointID]; }; listener.payload_progress_cb = - [&delegate](absl::string_view endpoint_id, const PayloadProgressInfo &info) { + [delegate](absl::string_view endpoint_id, const PayloadProgressInfo &info) { NSString *endpointID = @(std::string(endpoint_id).c_str()); GNCPayloadStatus status; switch (info.status) { diff --git a/internal/platform/implementation/apple/Mediums/WiFiLAN/GNCWiFiLANSocket.m b/internal/platform/implementation/apple/Mediums/WiFiLAN/GNCWiFiLANSocket.m index 427d4e8fa3..62744ca775 100644 --- a/internal/platform/implementation/apple/Mediums/WiFiLAN/GNCWiFiLANSocket.m +++ b/internal/platform/implementation/apple/Mediums/WiFiLAN/GNCWiFiLANSocket.m @@ -57,7 +57,7 @@ - (NSData *)readMaxLength:(NSUInteger)length error:(NSError **)error { } #if __LP64__ // This cast is only safe in a 64-bit runtime. - blockResult = (NSData *)content; + blockResult = [(NSData *)content copy]; #else blockResult = nil; #endif