小编bop*_*opa的帖子

protobuf-net:序列化一个空列表

我们在序列化一个空列表时遇到了一些问题.这里有一些使用CF 2.0的.NET代码

//Generating the protobuf-msg
ProtoBufMessage msg = new ProtoBufMessage();
msg.list = new List<AnotherProtobufMessage>();
// Serializing and sending throw HTTP-POST
MemoryStream stream = new MemoryStream();
Serializer.Serialize(stream, msg);
byte[] bytes = stream.ToArray();
HttpWebRequest request = createRequest();
request.ContentLength = bytes.Length ;

using (Stream httpStream = request.GetRequestStream())
{              
      httpStream.Write(bytes, 0, bytes.Length);
}
Run Code Online (Sandbox Code Playgroud)

当我们尝试在流上写入时(bytes.length超出范围),我们得到了一个异常.但是具有空列表的类型不应该是0字节,对(类型信息?)?

我们需要这种类型的发送,因为在响应中是来自服务器的消息给我们的客户端.

.net c# serialization protobuf-net

28
推荐指数
1
解决办法
7542
查看次数

如何在xcode4中实现应用程序测试?

我正在尝试为我的应用程序添加一些测试.在Apple的文档之后,我将两个测试包添加到我的项目中.逻辑测试没有问题,但是当我尝试在设备上进行应用程序测试时,我总是得到逻辑测试不在设备上运行的错误.

在Xcode 3中没有问题.只有Xcode 4会抛出此错误...

有什么建议?

蒂姆,谢谢

iphone testing xcode4 xcode3to4

11
推荐指数
1
解决办法
4241
查看次数

如果视图消失,uiview animate的完成块从未调用过

我注意到一些奇怪的行为.当我开始动画并更改视图(视图不会被解雇!)时,完成处理程序永远不会被调用.

[UIView animateWithDuration:0.1f 
                          delay:0.0f 
                        options:UIViewAnimationCurveEaseOut 
                     animations:^(void){
                         [myView setHidden:YES];
                         myLabel.alpha = 0.0f;
                         someOtherView.frame = CGRectMake(130, bubbleBigRect.origin.y, 61, 65);
                         [button setHidden:YES];
                     } 
                     completion:^(BOOL finished){
                         NSLog(@"Complete %d",finished);
                         [imageVIew setImage:[UIImage imageNamed:@"myPng.png"]];                    
                     }];
}
Run Code Online (Sandbox Code Playgroud)

这有什么解决方案吗?

iphone uiview uiviewanimation ios

8
推荐指数
2
解决办法
4133
查看次数