关于报错:'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based
最近在看Extension相关知识的时候,自己写了个小demo
发现[UIApplication sharedApplication]这个方法敲不出来了,
总是报错:'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based.....
在网上找了一些觉得办法,大多都是在说把cocoapods卸载了重装的
但很明显 我的问题不是由于这个原因导致的
然后我问题的解决办法就是在pods Target里面,点击buildSettings 搜索Require
然后把Require Only App-Extension-Safe API 然后把YES改为NO即可
如图所示:

在工程项目里也可按照这个方法去排查原因.
另外,在iOS 10.0以前的年代,打开一个网页或者进行跳转,直接使用[[UIApplication sharedApplication] openURL方法就可以了,但是在iOS10已经被废弃了,因为使用这种方式,处理的结果我们不能拦截到也不能获取到,对于开发是非常不利的,在iOS 10全新的推出了[UIApplication sharedApplication] openURL:nil options:nilcompletionHandler:^(BOOL success);有一个成功的回调block可以进行监视。
更多ios10新特性可阅读以下博客
iOS10---新特性以及适配点
关于报错:'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based的更多相关文章
- iOS9中找不到XXX.dylib 与 is unavailable no availabel on ios (app extension) - use view controller 的解决办法
在 iOS9 中现在找不到 XXX.dylib 了,比如libz.tbd 如果要用到 libz.dylib,可以用下面的办法,来自 Stack Overflow. Go to Build Phase ...
- Xcode 9.0 报错, Safe Area Layout Guide Before IOS 9.0
Xcode 9.0 新建工程报错 xcode Safe Area Layout Guide Before IOS 9.0 如下图,在Builds for 选择iOS9.0 and Later,不勾选U ...
- Django 报错 Reverse for 'content' not found. 'content' is not a valid view function or pattern name.
Django 报错 Reverse for 'content' not found. 'content' is not a valid view function or pattern name. 我 ...
- nagios监控报错 It appears as though you do not have permission to view...
今天在安装完nagios后,通过nagios网页界面点击主机.服务.问题页面时.均报错,报错的内容都差不多.如点击服务,报错: It appears as though you do not have ...
- 终极报错解决方案:Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed with
遇到这个报错的时候,不要慌 Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger fail ...
- 转)VCSA 6.5重启无法访问,报错“503 Service Unavailable”的解决方法
1. 问题 重启vcenter,登陆vsphere client,提示 “503 Service Unavailable (Failed to connect to endpoint: [N7Vmac ...
- 后台地址报错:Service Unavailable
首先考虑数据库是否打开? 第二重启IIS试试: 重启下iis试试(cmd接着iisreset) 再次访问就正常了,可以借鉴,但不一定就只是这一种原因.
- Xcode 9.0 报错,Safe Area Layout Guide Before IOS 9.0
解决方案就是: 第一步 第二步 第三步 重新编译.
- gunicorn启动报错gunicorn.errors.HaltServer
启动gunicorn报错: # gunicorn -b :9008 -w 2 webserver:app 2013-12-10 09:12:58 [29701] [INFO] Starting gun ...
随机推荐
- sql2008来远程访问sql2005数据库服务器
今天搞了一个下午终于搞定了数据库的远程访问.其基本步骤如下: sql2008的配置: sql server 2008默认是不允许远程连接的,sa帐户默认禁用的,如果想要在本地用SSMS连接远程服务器上 ...
- maven3实战之maven使用入门(使用archetype生成项目骨架)
maven3实战之maven使用入门(使用archetype生成项目骨架) ---------- maven提供了archetype以帮助我们快速勾勒出项目骨架.以Hello World为例,我们使用 ...
- GotGitHub
github在线教程 http://www.worldhello.net/gotgithub/
- IE=EmulateIE8和IE=IE8的区别
IE=8<meta http-equiv="X-UA-Compatible" content="IE=8" />This forces IE 8 t ...
- How to bind to data when the DataContext is not inherited【项目】
http://www.thomaslevesque.com/2011/03/21/wpf-how-to-bind-to-data-when-the-datacontext-is-not-inherit ...
- 7. 泛化(Generalization)
什么是泛化关系?用一个例子简单的说:假设A是B和C的父类,B.C具有公共类(父类)A,说明A是B.C的一般化(概括,也称泛化),B.C是A的特殊化. 在编程上,泛化关系(Generalization) ...
- js 对象与函数的区别
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...
- 关于document.referrer的使用需要注意
项目使用到一个场景,ajax请求返回无权限,跳回登录页面,登录后自动返回之前的浏览页,跳转由前端处理,于是想到document.referrer,但是对可靠性不确定,特意搜索了一下相关资料,大致整理如 ...
- android布局太深导致的 java.lang.StackOverflowError
E/AndroidRuntime( 1900): java.lang.StackOverflowError E/AndroidRuntime( 1900): at android.graphi ...
- CSS实现标题右侧“更多”
HTML < h2>< a h ref="#" >标题< /a> < span>更多…< /span> < /h2 ...