Using the following to try and get text from system clipboard
// Get a reference to the system pasteboard
Declare Function NSClassFromString Lib “Foundation” (className As CFStringRef) As Ptr
Var uiPasteboardClass As Ptr = NSClassFromString(“UIPasteboard”)
Declare Function generalPasteboard Lib “UIKit” Selector “generalPasteboard” (classRef As Ptr) As Ptr
Var pasteboard As Ptr = generalPasteboard(uiPasteboardClass)
// Get the value from the pasteboard
Declare Sub getValue Lib “UIKit” Selector “ValueForPasteboardType:” (pasteboardReference As Ptr, _pasteboardType As CFStringRef) as CFStringRef
var cliptext As String
cliptext = getValue(generalPasteboard(NSClassFromString(“UIPasteboard”)), “public.text”)
return cliptext
Missing something getting Syntax error Declare Sub get value any thoughts?
Var c As Clipboard
// create an instance of the clipboard
c = New Clipboard
// check for textAvailable
If c.TextAvailable Then
// text is available, set the TextField to it
TextField1.Text = c.Text
End If
// close it
c.Close
Look at which section of the forum this thread is in
And, well, it actually matters; I’m seeing the same thing.
Clipboard support for iOS isn’t extensive yet. For the time being, you can just let the reference go out of scope (e.g. setting the variable to nil, or exiting the current sub/function) and this should release the clipboard.
I added this method to a Module, and it gets the text from the iOS clipboard for me.
Public Function GetClipboardText() As String
Declare Function generalPasteboard Lib "UIKIt" Selector "generalPasteboard" (clsRef As ptr) As ptr
Declare Function NSClassFromString Lib "Foundation" (clsName As cfstringref) As ptr
Declare Function getValue Lib "UIKit" Selector "valueForPasteboardType:" (obj_id As ptr, pasteboardType As CFStringRef) As CFStringRef
Var myString As String = getValue(generalPasteboard(NSClassFromString("UIPasteboard")), "public.text")
Return myString
End Function