Method "session:peer:didChangeState"
I read that article : " http://www.devx.com/wireless/Article/43502/0/page/1 "
I want to integrate in my application Bluetooth. I had a problem. I want to connect 2 devices and i want to know if the function "session:peer:didChangeState" is called on the both device. In my opinion i think it is called on the both devices.
I want to know if the method session:peer:didChangeS开发者_JAVA百科tate is called on the both devices .
I want to send via bluetooth a structure: My structure is following :
typedef struct Package
{
tip_Comunicare_Enum type;
union mesaj_Comunicare
{
Msg_Cerere_Struct msg_Cerere;
Msg_Raspuns_Struct msg_Raspuns;
Msg_Initializare msg_Initializare;
}mesaj_Comunicare;
}
Package ;
My serializer looks like that :
-(void) SendData:(Package *) pachet
{
NSLog(@"Send DATA pachet");
printf("%d\n",sizeof(*pachet));
NSData * myData = [[NSData dataWithBytes:pachet
length:sizeof(*pachet)] autorelease];
[self mySendDataToPeers:myData];
}
If i use like that it is doesn't work and i give SIGKILL or something like that.
Thant for the time spent with me :)
NSData * myData = [[NSData dataWithBytes:pachet
length:sizeof(*pachet)] autorelease];
myData is already autoreleased. You have to write:
NSData * myData = [NSData dataWithBytes:pachet
length:sizeof(*pachet)];
Remember: autorelease message is sent as many times as it is called.
精彩评论