Objective-C 日出和日落库?
是否有一个 Objective-C(或 C)库(与核心位置兼容)可以告诉我任何给定日历日的日出和日落时间?
Is there an Objective-C (or C) library (that is compatible with core location) that can tell me the time of sunrise and sunset for any given calendar day?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
EDSunriseSet 是一个开源且免费的 Objective-C 包装器,用于由 保罗·施莱特。
计算完全由 C 代码例程完成。 EDSunrisetSet 将这些计算桥接到常见的 Cocoa 类(NSDate、NSTimeZone,...)
EDSunriseSet is an open source and free Objective-C wrapper for the C languages routines created by Paul Schlyter.
Calculation is done entirely by the C-code routines. EDSunrisetSet bridges those calculations to common Cocoa classes (NSDate, NSTimeZone, ...)
我实际上已经移植了 KosherJava 库 并计划很快在 GitHub 上提供它!
编辑:
KosherCocoa 现已在 GitHub 上上线!如果不需要希伯来日历相关代码,可以删除“calendar”文件。类文件根据其执行的计算类型被很好地分成文件夹。
编辑:KosherCocoa 我们将尽快更换为现代且更完整的更新。上面的链接现在指向旧存储库。
I've actually ported the KosherJava Library and plan to make it available soon on GitHub!
Edit:
KosherCocoa is now live on GitHub! If you don't need the hebrew calendar related code, you can delete the "calendar" file. The class files are separated nicely into folders based on the kinds of calculations that they do.
Edit: KosherCocoa us due to be replaced with a modern and more complete update as soon as I can. The above link now points at a legacy repo.
我使用了一个名为 SUNWAIT 的库。非常简单、有效——易于使用!
I have used a library called SUNWAIT. Very simple, effective - easy to use!
试试这个: https://github.com/mourner/suncalc/
非常清晰且易于实现,虽然它是由 javascript 编写的,但很容易将其转换为
Objective-C
它还支持计算太阳、月亮的位置和坐标。
Try this: https://github.com/mourner/suncalc/
Very clear and easy to implement, although it writen by javascript but it is easy to convert it to
objective-C
It also support for calculate sun, moon position and coordinate.
在找不到简单的 Swift 替代方案后,我创建了 Solar:一个为 Sunrise / Sunset 构建的 Swift 微型库。
After not finding a simple Swift alternative, I created Solar: a Swift built micro-library for Sunrise / Sunset.
请注意...如果您使用伯克利...那么它不起作用(至少在澳大利亚)。
不过它确实包含了 Paul Schlyter C 代码,这非常棒。
如果您希望它在任何地方都可以工作,最好只计算 UTC 中的日期。
在 SunriseAndSunset.m 中,替换以下代码
双升;
双套;
如下:
Just a note.. if you use the Berkley one... well it doesn't work (in Australia as least).
It does include the Paul Schlyter C code though, which is great.
If you want it to work anywhere, best to just calc the dates in UTC.
In SunriseAndSunset.m, replace the code from
double rise;
double set;
as follows:
试试这个:https://github.com/berkley/ObjectiveCUtil
try this one: https://github.com/berkley/ObjectiveCUtil