访问私人版本的iOS API,如何? [英] Accessing Private iOS Apis, How to?

查看:118
本文介绍了访问私人版本的iOS API,如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从iOS SDK访问一些私有的API,涉及到相机,如:

I would like to access some private APIs from the iOS SDK, related to the Camera like:

- (void)setExposureMode:(int)arg1;
- (int)exposureMode;

等。这只是我个人的发展,我不要提交任何应用程序商店的计划。但我似乎无法弄清楚如何访问和使用这些API。是否有任何教程或书,介绍的程序?

Etc. This is only for my personal development and I don't plan on submitting any Apps to the store. But I can't seem to figure out how to access and use these APIs. Is there any tutorial or book explaining the procedure?

例如,我想加入这一行到我的.h文件中:

For example, I tried adding this line to my .h file:

@interface AVCaptureDevice (Private)

- (void)setExposureMode:(int)arg1;

@end

但是,当我把这个API从我的应用程序,它崩溃。尽管respondsToSelector返回TRUE。

But when I call this API from my App, it crashes. Even though respondsToSelector returns TRUE.

所以,任何人都可以联系我一些很好的资源,了解私有API编程?

So could anyone link me to some good resources to learn about private API programming?

推荐答案

你在做什么在语法上是正确的差不多。

What you are doing is syntactically almost correct.

唯一的问题是,在你的类声明中使用的是 INT 而不是浮动。你可以尝试改变这一点,看看情况有所改善,但我怀疑问题出在其它地方。

The only issue is that in your category declaration you are using int instead of float. You might try and change this and see if things improve but I suspect the problem lies elsewhere.

使用私有API,没有可用的描述关于应该使用它的方法方式。所以,也许你正在呼吁在错误的时间或错误的上下文的方法。可能检查崩溃日志可以给一些启发。

With private API, no description is available about the way its methods should be used. So, maybe you are calling a method at the wrong time or in the wrong context. Possibly inspecting the crash log could give some insights.

还有一件事,看你的崩溃:可能是事实,这是崩溃是因为你设置exposureMode不支持。尝试使用(<一个href=\"http://developer.apple.com/library/ios/#documentation/AVFoundation/Reference/AVCaptureDevice_Class/Reference/Reference.html\"相对=nofollow> REF ):

One more thing, looking at your crash: possibly the fact that it is crashing is because the exposureMode you set is not supported. Try and use (ref):

- (BOOL)isExposureModeSupported:(AVCaptureExposureMode)exposureMode

手前检查(如果你不这样做的话)。

to check it before hand (if your are not doing it already).

这篇关于访问私人版本的iOS API,如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆