diff --git a/connections/swift/NearbyCoreAdapter/Sources/GNCCoreAdapter.mm b/connections/swift/NearbyCoreAdapter/Sources/GNCCoreAdapter.mm index 8a55cd61..716424e6 100644 --- a/connections/swift/NearbyCoreAdapter/Sources/GNCCoreAdapter.mm +++ b/connections/swift/NearbyCoreAdapter/Sources/GNCCoreAdapter.mm @@ -278,13 +278,13 @@ GNCStatus GNCStatusFromCppStatus(Status status) { 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 427d4e8f..62744ca7 100644 --- a/internal/platform/implementation/apple/Mediums/WiFiLAN/GNCWiFiLANSocket.m +++ b/internal/platform/implementation/apple/Mediums/WiFiLAN/GNCWiFiLANSocket.m @@ -57,7 +57,7 @@ } #if __LP64__ // This cast is only safe in a 64-bit runtime. - blockResult = (NSData *)content; + blockResult = [(NSData *)content copy]; #else blockResult = nil; #endif