2015-03-1717:25:55.249MyProject[36665:3189330] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MyProject.Demo onRequestCompleted:]: unrecognized selector sent to instance 0x7f9fd3df1d00'
百思不得其解只能求助文档和 Stackoverflow 了,因为这个错误太普遍,而且在 swift 中很多人还没有去踩坑。所以花了很长的时间才发现,原来在我们的文档中有这样的一段:
To be accessible and usable in Objective-C, a Swift class must be a descendant of an Objective-C class or it must be marked @objc.
Swift declarations marked with the private modifier do not appear in the generated header. Private declarations are not exposed to Objective-C unless they are explicitly marked with @IBAction,@IBOutlet, or @objc as well.
Objective-C classes must be named uniquely not only within the code that you’re writing in a project, but also across any frameworks or bundles you might be including.
当然啦,苹果也给出了自己的建议:
In order to keep class names unique, the convention is to use prefixes on all classes. You’ll have noticed that Cocoa and Cocoa Touch class names typically start either with NS or UI. Two-letter prefixes like these are reserved by Apple for use in framework classes. Your own classes should use three letter prefixes. These might relate to a combination of your company name and your app name, or even a specific component within your app
I always encounter this issue if I’ve got an Exception Breakpoint enabled when I play a video. If I disable it then it works fine. I’ve submitted a bug report to Apple also. This seems to be a problem with trying to play videos on the simulator.
Alamofire is an HTTP networking library written in Swift, from the creator of AFNetworking. 大神 mattt 的又一作品,和 AFNetworking 类似,但是是用纯 swift 实现的,而且只有一个文件,代码量也很少。
Haneke is a lightweight generic cache for iOS written in Swift.Haneke provides a memory and LRU disk cache for UIImage, NSData, JSON, String or any other type that can be read or written as data.Particularly, Haneke excels at working with images. It includes a zero-config image cache with automatic resizing.
Quick is a behavior-driven development framework for Swift and Objective-C. Inspired by RSpec, Specta, and Ginkgo. 一个 BDD 的测试框架,支持 Swift 和 Objective-C。
Dollar is a Swift library that provides useful functional programming helper methods without extending any built in objects. It is similar to Lo-Dash or Underscore.js in Javascript. Cent is a library that extends certain Swift object types using the extension feature and gives its two cents to Swift language.
The water is clear and the mountain is bright. The frost comes in at night, trees are covered with deep scarlet leaves mixed with yellow that is light. 这里的 bright,night和light也都比较押韵。
有路才能人畅其行,物畅其流
With roads in place, people and goods can flow.
志同道合
People who cherish the same ideals follow the same path.
志存高远,脚踏实地
Aspire for high and grand while planting our feet firmly on the ground.
朋友多了,路才好走
More friends, more opportunities.
大时代需要大格局,大格局需要大智慧
A great era calls for great vision, which in turn requires great wisdom.s
注意这里使用的 FOUNDATION_EXPORT 因为,当你在 objective-c 中引入了 Foundation Framework 之后,你最好是用 FOUNDATION_EXPORT 来代替 extern, 因为在 NSObjCRuntime.h 中它包括了一些 C 和 C++ 的库,为了能更好的和这些 C 和 C++ 库兼容,所以建议用 FOUNDATION_EXPORT。
Adding open and close animation on WSPieChartWithMotionView.So when you press the pie, you can find it open smoothly. But WSPieChartView doesn’t have this function.
Adding transformation on the pie when update the datas. This is only support on WSPieChartWithMotionView.