Example for iOS works ok, but when I'm trying to use libs in my own project (swift version with objective-c++ .mm classes bridges) I get next error:
Cannot initialize a variable of type 'PTExampleTextFrame *' (aka '_PTExampleTextFrame *') with an rvalue of type 'void *'
in this function (Peertalk Example) PTExampleProtocol.h
also this header file for Mac target/project, so does why iOS target/project reference to it?
static dispatch_data_t PTExampleTextDispatchDataWithString(NSString *message) {
// Use a custom struct
const char *utf8text = [message cStringUsingEncoding:NSUTF8StringEncoding];
size_t length = strlen(utf8text);
//CFAllocatorAllocate(nil, 1 + length, 0);
PTExampleTextFrame *textFrame = CFAllocatorAllocate(nil, sizeof(PTExampleTextFrame) + length, 0);
memcpy(textFrame->utf8text, utf8text, length); // Copy bytes to utf8text array
textFrame->length = htonl(length); // Convert integer to network byte order
// Wrap the textFrame in a dispatch data object
return dispatch_data_create((const void*)textFrame, sizeof(PTExampleTextFrame)+length, nil, ^{
CFAllocatorDeallocate(nil, textFrame);
});
