0
我有一個問題。 我想在CFDataRef中將我的對象「位置」轉換爲在TCP套接字中發送它。 我不知道我能做些什麼。 你能幫我嗎?轉換CFDataRef
@interface Position : NSObject {
NSString *name;
float valueX;
float valueY;
float valueZ;
}
-(BOOL)setValue:(NSString*)name:(float)valueX:(float)valueY:(float)valueZ;
@property (nonatomic,readwrite, retain) NSString *name;
@property (readwrite) float valueX;
@property (readwrite) float valueY;
@property (readwrite) float valueZ;
@end
//In another class after the correct connection.
Position *tempPosition = [[Position alloc]init];
for(int i=0; i<[arrayPosition count]; i++){
tempPosition = [arrayPosition objectAtIndex:i];
//I want have a CFDataRef of tempPosition for sending. dataSend is my CFDataRef variable
CFSocketSendData(socketAccept, NULL, dataSend, 0);
[NSThread sleepForTimeInterval:1];
}