我有一个发布NSDictionary的NSNotification:
NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:
anItemID, @"ItemID",
[NSString stringWithFormat:@"%i",q], @"Quantity",
[NSString stringWithFormat:@"%@",[NSDate date]], @"BackOrderDate",
[NSString stringWithFormat:@"%@", [NSDate date]],@"ModifiedOn",
nil];
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:@"InventoryUpdate" object:dict]];
Run Code Online (Sandbox Code Playgroud)
我如何订阅此并从此NSDictionary获取信息?
在我的viewDidLoad我有:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(recieveInventoryUpdate:) name:@"InventoryUpdate" object:nil];
Run Code Online (Sandbox Code Playgroud)
和班上的方法:
- (void)recieveInventoryUpdate:(NSNotification *)notification {
NSLog(@"%@ updated", [notification userInfo]);
}
Run Code Online (Sandbox Code Playgroud)
当然记录一个空值.

您可以轻松添加单个UIBarButton项目,如我在Storyboard中所示.但我想添加几个,似乎我不能使用故事板?
这很烦人,因为那时我失去了故事板的全部概述,而且它是Segue的.
是这样的吗?第一个项目使用故事板,所以我想我可能会遗漏一些东西.
我正在使用asp.net WebAPI,我需要创建一个自定义ActionFilter,它会快速检查请求URI的用户是否真的能够获取数据.
他们已被授权通过基本身份验证使用Web服务,并且他们的角色已通过自定义角色提供程序进行验证.
我需要做的最后一件事是检查他们是否有权使用URI中的参数查看他们请求的数据.
这是我的代码:
public class AccessActionFilter : FilterAttribute, IActionFilter
{
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> ExecuteActionFilterAsync(HttpActionContext actionContext, System.Threading.CancellationToken cancellationToken, Func<System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>> continuation)
{
var result = //code to see if they have permission returns either 0 or 1
if (result==0) {
throw new ArgumentException("You do not have access to this resource");
}
return continuation();
}
}
Run Code Online (Sandbox Code Playgroud)
目前我只是抛出一个不是我想要的错误,我宁愿回来,System.Net.HttpStatusCode.Unauthorized但我对我压倒的方法感到有点恼火,我完全不理解它.
我该如何回归这个价值?
我在iTunes连接中启动了我的应用程序的新版本,我不想和/或不需要它 - 我该如何摆脱它?目前处于"等待上传"状态.
我有一个满是地址的数据库,我需要得到lat和long,所以我想循环遍历它们并使用Google Geocode来更新我的数据库.我被困在如何解析JSOn结果以获得我需要的东西:
var address = "http://maps.google.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false";
var result = new System.Net.WebClient().DownloadString(address);
GoogleGeoCodeResponse test = JsonConvert.DeserializeObject<GoogleGeoCodeResponse>(result);
Run Code Online (Sandbox Code Playgroud)
我以为我可以简单地构建一个快速类并使用JSON.Net来反序列化结果,它有点工作但我想我在我的类结构上吹它:
public class GoogleGeoCodeResponse {
public string status { get; set; }
public geometry geometry { get; set; }
}
public class geometry {
public string location_type { get; set; }
public location location { get; set; }
}
public class location {
public string lat {get;set;}
public string lng {get;set;}
}
Run Code Online (Sandbox Code Playgroud)
以下是从Google返回的内容示例:
{
"status": "OK",
"results": [ {
"types": [ "street_address" ],
"formatted_address": "1600 …Run Code Online (Sandbox Code Playgroud) 我如何摆脱这个错误,我使用Visual Studio 2008,因为2010年不会打开我的一些VB项目.
我需要使用旧数据库中1列的数据更新我的新数据库.基本上基于匹配ItemID,我需要在新DB中使用旧DB中的值设置Description列.我可以看到当我进行连接时需要更新的内容,但我不确定如何正确处理此更新.
有没有办法在iOS4中使用除NSThread以外的其他东西延迟调用方法或使用sleep()阻止UI?
我正在开发2个不同的应用程序,它们共享95%的相同代码和视图.使用Xcode最好的方法是什么?
我试图在我的网站上添加一些schema.org的东西,剃刀视图引擎给我带来麻烦.这是我想要添加到我的主要布局的内容:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Organization",
"url": "http://www.example.com",
"logo": "http://www.example.com/media.ashx/repzio-icon.png"
}
</script>
Run Code Online (Sandbox Code Playgroud)
@context是这里的问题,我该如何解决这个问题?
ios ×3
ipad ×3
iphone ×3
objective-c ×2
xcode ×2
asp.net ×1
asp.net-mvc ×1
c# ×1
google-maps ×1
ios5 ×1
json ×1
razor ×1
schema.org ×1
sql ×1