我正试图让用户在今日推广中的位置,我正在走向死胡同.
在OS X应用程序上,当您拨打电话时locationManager.startUpdatingLocation()
,会弹出一个对话框,询问您是否要让应用程序使用您的位置.但是在Today视图中,调用此方法后根本没有任何内容,并且我的委托不会被调用didUpdateLocations
或for didFailWithError
.CLLocationManager.authorizationStatus()
回报NotDetermined
.我一直在查看Apple关于今日扩展的文档,并且没有太多关于权限或获取用户位置的信息.
我们如何在OS X Today Extension中获取用户的位置?
编辑:需要注意的一件事是我的OS X应用程序和我的今日扩展程序上的CLLocationManager.locationServicesEnabled()
返回.这意味着什么,我该如何改变呢?true
false
我正在努力将.NET Framework 4.5应用程序移植到.NET Core 2.0,并开始在我的Mac上进行一些测试.当我在Windows上的.NET Core 2.0上运行此代码时,它工作正常:
TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time");
Run Code Online (Sandbox Code Playgroud)
但它在Mac上抛出以下异常:
System.TimeZoneNotFoundException: The time zone ID 'Pacific Standard Time' was not found on the local computer. ---> System.IO.FileNotFoundException: Could not find file '/usr/share/zoneinfo/Pacific Standard Time'.
at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.File.ReadAllBytes(String path)
at System.TimeZoneInfo.TryGetTimeZoneFromLocalMachine(String id, TimeZoneInfo& value, Exception& e)
--- End of inner exception stack …
Run Code Online (Sandbox Code Playgroud) 我有一个Roslyn分析器,我最近更新了使用CSharp.Workspaces的2.3版本.我发现当我构建时,我收到如下警告:
Analyzer尝试注册"异步"操作,但不支持此操作.
我添加的一些操作是异步的,因为它们从Roslyn API调用异步方法,如下面的假设示例所示.
public override void Initialize(AnalysisContext context)
{
context.RegisterSymbolAction(AnalyzeProperty, SymbolKind.Property);
}
private async void AnalyzeProperty(SymbolAnalysisContext context)
{
var property = (IPropertySymbol) context.Symbol;
foreach (var syntaxRef in property.DeclaringSyntaxReferences)
{
DoSomethingWith(await syntaxRef.GetSyntaxAsync());
}
}
Run Code Online (Sandbox Code Playgroud)
我是不是应该改变任何使用await
到.Result
或.Wait()
在工作,还是有我应该纠正响应警告我的代码一些其他的方式?
如何找到索引中已修改文件的数量?也就是说,运行时显示为“已修改”的文件git status
。
我知道很多可视化git工具都可以执行此操作,还有一些shell插件可以在提示旁边显示计数,但是我只是看不到如何以合理的方式在命令行上进行操作。