ios语音输入崩溃
2016-04-11 17:10
519 查看
游戏中任何可以输入的地方,只要调用语音输入,必然会导致app崩溃,解决方法如下:
ok, so essentially the gist of it is that siri wants gl context and to be rendered alongside your view. So you need to play nice with it.
first of all in Classes/Unity/EAGLContextHelper.h
add forward declaration for
and then inside class EAGLContextSetCurrentAutoRestore add constructor:
so it looks like that
then in Classes/Unity/EAGLContextHelper.mm
add
and implementation for new ctor
Afterwards you just need to go to Classes/UnityAppController+Rendering.mm and add
to
so it looks like this
again, i cannot even build 4.x now, so you need to use c/objc knowledge to fix possible compilation errors (if i forgot to mention some incudes or smth)
参考自:http://forum.unity3d.com/threads/dictation-siri-keyboard-crash.358123/
ok, so essentially the gist of it is that siri wants gl context and to be rendered alongside your view. So you need to play nice with it.
first of all in Classes/Unity/EAGLContextHelper.h
add forward declaration for
struct UnityDisplaySurfaceBase;
and then inside class EAGLContextSetCurrentAutoRestore add constructor:
EAGLContextSetCurrentAutoRestore(UnityDisplaySurfaceBase* surface);
so it looks like that
struct UnityDisplaySurfaceBase; <...> class EAGLContextSetCurrentAutoRestore { public: EAGLContext* old; EAGLContext* cur; EAGLContextSetCurrentAutoRestore(EAGLContext* cur); EAGLContextSetCurrentAutoRestore(UnityDisplaySurfaceBase* surface); ~EAGLContextSetCurrentAutoRestore(); };
then in Classes/Unity/EAGLContextHelper.mm
add
#include "UnityRendering.h"
and implementation for new ctor
EAGLContextSetCurrentAutoRestore::EAGLContextSetCurrentAutoRestore(UnityDisplaySurfaceBase* surface) : old(surface->api == apiMetal ? nil : [EAGLContext currentContext]), cur(surface->api == apiMetal ? nil : ((UnityDisplaySurfaceGLES*)surface)->context) { if (old != cur) [EAGLContext setCurrentContext:cur]; }
Afterwards you just need to go to Classes/UnityAppController+Rendering.mm and add
EAGLContextSetCurrentAutoRestore autorestore(GetMainDisplaySurface());
to
static void UnityRepaintImpl(bool forced)
so it looks like this
static void UnityRepaintImpl(bool forced) { @autoreleasepool { EAGLContextSetCurrentAutoRestore autorestore(GetMainDisplaySurface()); Profiler_FrameStart(); <...>
again, i cannot even build 4.x now, so you need to use c/objc knowledge to fix possible compilation errors (if i forgot to mention some incudes or smth)
参考自:http://forum.unity3d.com/threads/dictation-siri-keyboard-crash.358123/
相关文章推荐
- IOS中textField如何关闭键盘
- iOS可持续化集成: Jenkins + bundler + cocoapods + shenzhen + fastlane + pgyer
- iOS - 工厂模式
- iOS开发 长按图片保存到相册
- IOS-数据存储之NSkeyedArchiver用法
- 获取iOS设备唯一标识
- iOS开发 滤镜效果
- iOS开发 预览Word文档
- iOS 的旋屏控制技巧
- iOS中属性与成员变量的区别
- IOS响应式编程框架ReactiveCocoa(RAC)使用示例
- iOS开发调试Reveal使用
- iOS手势之pinch
- ios 之 instancetype与id
- iOS 系统启动前的显示图片
- iOS Base64加密图片
- iOS通知中心升级 -可设置按优先级执行block
- iOS开发系列--通知与消息机制
- iOS闪退(崩溃)手动再符号化解析
- ios获取图片exif信息