Michiluki
Michiluki

Reputation: 505

Toll free bridging Monotouch

I've got a problem with monotouch. Im not sure how to do toll free bridging.

My code is

    NSInputStream iStream;
    NSOutputStream oStream;

    CFWriteStream cfWrite;
    CFReadStream cfRead;
    CFStream.CreatePairWithSocketToHost(server, port, out cfRead, out cfWrite);
    iStream = (__bridge_transfer NSInputStream)cfRead;

Ok so (__bridge) etc. doesn't exist, but simple casting like

    iStream = (NSInputStream)cfRead;

also won't work.

Which is the right way to do this ?

Upvotes: 1

Views: 145

Answers (1)

dragondx
dragondx

Reputation: 96

Update

NSInputStream constructor is not directly accessible anymore. Use this instead:

using ObjCRuntime;
...
iStream = Runtime.GetNSObject<NSInputStream>(cfRead.Handle);

See here: Documentation

Upvotes: 1

Related Questions