ios8,xcode6 周边
NSBundle.mainBundle().infoDictionary
iOS 8中带按钮的推送代码
if ( UIDevice.currentDevice().systemVersion.hasPrefix("") ){
application.registerForRemoteNotificationTypes(UIRemoteNotificationType.Badge | UIRemoteNotificationType.Alert | UIRemoteNotificationType.Sound)
}else {
var userNotificationAction = UIMutableUserNotificationAction()
userNotificationAction.activationMode = .Foreground
userNotificationAction.identifier = "identifier1"
userNotificationAction.title = "打开程序"
var userNotiAction = UIMutableUserNotificationAction()
userNotiAction.activationMode = .Background
userNotiAction.identifier = "identifier2"
userNotiAction.title = "发送消息"
userNotiAction.authenticationRequired = false
userNotiAction.destructive = true
var category = UIMutableUserNotificationCategory()
category.identifier = "idCategory"
category.setActions([userNotificationAction,userNotiAction], forContext: .Default)
var userNotiSet = UIUserNotificationSettings(forTypes: UIUserNotificationType.Sound | UIUserNotificationType.Alert | UIUserNotificationType.Badge , categories: NSSet(object: category))
application.registerUserNotificationSettings(userNotiSet)
application.registerForRemoteNotifications()
}
swift Code
category.identifier 服务器推送的json为
{"aps":{"category":"idCategory","alert":"alert","badge":"","sound":"default"}}
之后会根据 推送的category 显示哪个UIMutableUserNotificationCategory,当点击UIMutableUserNotificationAction时调用
func application(application: UIApplication, handleActionWithIdentifier identifier: String?, forRemoteNotification userInfo: [NSObject : AnyObject], completionHandler: () -> Void) {
println(identifier,userInfo)
if identifier == "identifier2" {
var dat = NSData(contentsOfURL: NSURL(string: "http://121.199.28.164/llc/api/?req=userList"))
var str = NSString(data: dat, encoding: NSUTF8StringEncoding)
println(str)
}
completionHandler()
}
swift Code
iOS 8中使用Swift和Xcode 6制作精美的UI组件
http://www.cocoachina.com/industry/20140619/8883.html
1、用 POST 方式发送请求:
http://itunes.apple.com/search?term=你的应用程序名称&entity=software
2、更简单的请求, 根据appid,查询返回结果
http://itunes.apple.com/lookup?id=[appid]
{
resultCount = 1;
results = (
{
artistId = 开发者 ID;
artistName = 开发者名称;
price = 0;
isGameCenterEnabled = 0;
kind = software;
languageCodesISO2A = (
EN
);
trackCensoredName = 审查名称;
trackContentRating = 评级;
trackId = 应用程序 ID;
trackName = 应用程序名称";
trackViewUrl = 应用程序介绍网址;
userRatingCount = 用户评级;
userRatingCountForCurrentVersion = 1;
version = 版本号;
wrapperType = software;
}
);
}
ios8,xcode6 周边的更多相关文章
- ios8 xcode6 下的启动界面设置和图标设置
IOS8 我试了网上不少设置启动动画的,不知道是不是我弄错了还是怎么的,反正启动不了,后来在code4论坛找到了这个: 启动屏幕:LaunchScreen.xib文件 桌面图标等相关app图片:Ima ...
- Ios8 Xcode6 设置Launch Image 启动图片
http://blog.sina.com.cn/s/blog_6c97abf10102voui.html Http://Www.woowen.com/Swift/2014/12/12/Ios8设置La ...
- Ios8,Xcode6下 设置Launch Image 启动图片
1x--320*480 2x--640*960 Retina 4--640*1136 Retina HD5.5--621*1104 Retina HD4.7--375*667
- Xcode6 storyboard new push segue 后的视图控制器没有navigation item bug.
手动切一下 老的push,再切回来,就会出有了,我想是一个bug. Xcode 6 Segue with UINavigationItem up vote0down votefavorite I' ...
- iOS8 PUSH解决方法
本文转载至 http://blog.csdn.net/pjk1129/article/details/39548523 - (void)registerForRemoteNotificatio ...
- Unable to run Kiwi tests on iOS8 device
本文转载至 http://stackoverflow.com/questions/25871601/unable-to-run-kiwi-tests-on-ios8-device 5down vote ...
- iPhone屏幕尺寸、分辨率及适配
转:http://blog.csdn.net/phunxm/article/details/42174937 目录(?)[+] 1.iPhone尺寸规格 设备 iPhone 宽 Width 高 H ...
- 【转】iPhone屏幕尺寸、分辨率及适配
原文网址:http://blog.csdn.net/phunxm/article/details/42174937 1.iPhone尺寸规格 设备 iPhone 宽 Width 高 Height 对角 ...
- iPhone手机的屏幕尺寸、分辨率及适配
1.iPhone尺寸规格 设备 iPhone 宽 Width 高 Height 对角线 Diagonal 逻辑分辨率(point) Scale Factor 设备分辨率(pixel) PPI 3GS ...
随机推荐
- apache开源项目--mina
Apache MINA(Multipurpose Infrastructure for Network Applications) 是 Apache 组织一个较新的项目,它为开发高性能和高可用性的网络 ...
- Darwin Streaming Server 安裝操作備忘
Darwin Streaming Server 安裝操作 Darwin Streaming Server是蘋果公司推出的開放源碼.跨平台多媒體串流伺服器, 提供音樂 (mp3) 與影音 (3gp.mp ...
- linux面试题1
一.填空题:1. 在Linux系统中,以 文件 方式访问设备 .2. Linux内核引导时,从文件 /etc/fstab 中读取要加载的文件系统.3. Linux文件系统中每个文件用 i节点 来标识. ...
- ios 照片编辑的view封装
转:http://www.cnblogs.com/xiaobaizhu/archive/2013/07/03/3170101.html 该控件有旋转,缩放,拖动,剪裁的功能,封装成了一个ImageCr ...
- linux编程获取本机网络相关参数
getifaddrs()和struct ifaddrs的使用,获取本机IP 博客分类: Linux C编程 ifaddrs结构体定义如下: struct ifaddrs { struct ifad ...
- AE与AO的区别
在ArcGis9.0之前,ArcObject还不是一个独立的产品,一直捆绑在Desktop产品中,只要你购买了desktop产品中的一个,你就可 以使用arcboject开发.从ArcGis9.0开始 ...
- Apache OFBiz 学习笔记 之 服务引擎 二
加载服务定义文件 ofbiz-component.xml:所有的服务定义文件在每个组件的ofbi-component.xml文件中 加载服务定义 例:framework/common/ofbi ...
- sql基本语句
---恢复内容开始--- 查询有几个不同的职位名称: select distinct name from a: group by: 现在有两个表product和sales,字段分别如下: TABLES ...
- [转]关于GCD与多线程
GCD是什么,你知道吗?你知道了GCD,你确定你会使用吗? 这一篇文章是站在初学者角度去分析GCD,原因是这个很多iOS开发者根本就没用过,即使用过,不知道其中的原理.讲解之前认识一下什么是线程,为什 ...
- asp.net MVC 安全性[笔记]
1. 跨站脚本(XSS) 1.1 介绍 1.1.1 被动注入,利用输入html,javascript 等信息伪造链接,图片等使用提交信息,调转页面等 1.1.2 主动注入,黑客主动参与攻击,不会傻等倒 ...