Skip to content

Commit

Permalink
[iOS] Fix: library symbols stripped on release
Browse files Browse the repository at this point in the history
For debug, a dummy call to any function in the library was enough; on
release, ALL need to be dummy-called.
  • Loading branch information
J-Pabon committed Nov 7, 2023
1 parent 4552994 commit b5e7beb
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion bindings/dart/ios/Classes/SwiftOuisyncPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,39 @@ public class SwiftOuisyncPlugin: NSObject, FlutterPlugin {

public func dummyMethodToEnforceBundling() {
// This will never be executed
session_close()

let session: SessionHandle = 0
let port: Int64 = 0
let pointer: Int64 = 0
let function: PostDartCObjectFn? = nil
let payload: UnsafeMutablePointer<UInt8>? = nil
let length: UInt64 = 0
let handle: UInt64 = 0
let stringPointer: UnsafeMutablePointer<Int>? = nil
let level: UInt8 = 0

let resultCreate = session_create_dart("", "", function, port)
print(resultCreate)

let resultClose = session_close(session)
print(resultClose)

let resultSend = session_channel_send(session, payload, length)
print(resultSend)

let resultShutdown = session_shutdown_network_and_close(session)
print(resultShutdown)

let resultFileCopy = file_copy_to_raw_fd_dart(session, handle, 0, function, port)
print(resultFileCopy)

let resultFileCopy2 = file_copy_to_raw_fd_dart(session, handle, 0, function, port)
print(resultFileCopy2)

let resultFreeString = free_string(stringPointer)
print(resultFreeString)

let resultLogPrint = log_print(level, "", "")
print(resultLogPrint)
}
}

0 comments on commit b5e7beb

Please sign in to comment.