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 周边的更多相关文章

  1. ios8 xcode6 下的启动界面设置和图标设置

    IOS8 我试了网上不少设置启动动画的,不知道是不是我弄错了还是怎么的,反正启动不了,后来在code4论坛找到了这个: 启动屏幕:LaunchScreen.xib文件 桌面图标等相关app图片:Ima ...

  2. Ios8 Xcode6 设置Launch Image 启动图片

    http://blog.sina.com.cn/s/blog_6c97abf10102voui.html Http://Www.woowen.com/Swift/2014/12/12/Ios8设置La ...

  3. Ios8,Xcode6下 设置Launch Image 启动图片

    1x--320*480  2x--640*960  Retina 4--640*1136  Retina HD5.5--621*1104   Retina HD4.7--375*667

  4. Xcode6 storyboard new push segue 后的视图控制器没有navigation item bug.

    手动切一下 老的push,再切回来,就会出有了,我想是一个bug. Xcode 6 Segue with UINavigationItem up vote0down votefavorite   I' ...

  5. iOS8 PUSH解决方法

    本文转载至 http://blog.csdn.net/pjk1129/article/details/39548523     - (void)registerForRemoteNotificatio ...

  6. Unable to run Kiwi tests on iOS8 device

    本文转载至 http://stackoverflow.com/questions/25871601/unable-to-run-kiwi-tests-on-ios8-device 5down vote ...

  7. iPhone屏幕尺寸、分辨率及适配

    转:http://blog.csdn.net/phunxm/article/details/42174937 目录(?)[+]   1.iPhone尺寸规格 设备 iPhone 宽 Width 高 H ...

  8. 【转】iPhone屏幕尺寸、分辨率及适配

    原文网址:http://blog.csdn.net/phunxm/article/details/42174937 1.iPhone尺寸规格 设备 iPhone 宽 Width 高 Height 对角 ...

  9. iPhone手机的屏幕尺寸、分辨率及适配

    1.iPhone尺寸规格 设备 iPhone 宽 Width 高 Height 对角线 Diagonal 逻辑分辨率(point) Scale Factor 设备分辨率(pixel) PPI 3GS ...

随机推荐

  1. codeforces 334B - Eight Point Sets

    题意难懂,其实就是x1<x2<x3与y1<y2<y3两两组合成九个点,去掉(x2,y2),剩余八个.这样的八个点才是满足要求的. 忘去重了 #include<cstdio ...

  2. 【C#学习笔记】Dictionary容器使用

    using System; using System.Collections.Generic; namespace ConsoleApplication { class Program { stati ...

  3. 数学语言和程序语言的对比:面向过程与面向集合&命题

    共同之处:都使用字符串或数值来引用一个客观实体.当然数字和字符串也可以作为实体对象,这取决于人的解释. 不同之处:数学语句每一行都给出了一个结论, 程序语句的每一行都定义了一个过程.注意这里所指的程序 ...

  4. linux笔试

    在对linux基本知识的归纳总结之后,这里是一份linux的测试题.希望能帮助大家复习和熟悉linux知识. 一.选择题 1.cron 后台常驻程序 (daemon) 用于:  A. 负责文件在网络中 ...

  5. 【转】Android fill_parent和wrap_content分析

    fill_parent设置一个顶部布局或控件强制性让它布满整个屏幕. wrap_content布局指根据视图内部内容自动扩展以适应其大小. 1. wrap_content <?xml versi ...

  6. 选择或者放弃MySQL的理由

    MySQL 作为一个开源数据库,自从被 Oracle 接管后,其发展前景就一直受到开发社区的关注,其中也有质疑,最近,两位开发者分别发表了选择和放弃MySQL 的理由,值得数据库相关人员参考. And ...

  7. 【转】ACE开发环境搭建

    Windows平台 1)        下载ACE源码 ACE官方网址:http://www.cs.wustl.edu/~schmidt/ACE.html ACE下载地址:http://downloa ...

  8. 我们究竟什么时候可以使用Ehcache缓存

    一.Ehcache是什么 EhCache是Hibernate的二级缓存技术之一,可以把查询出来的数据存储在内存或者磁盘,节省下次同样查询语句再次查询数据库,大幅减轻数据库压力. 二.Ehcache的使 ...

  9. BaseAdapter中重写getview的心得以及发现convertView回收的机制

    以前一直在用BaseAdapter,对于其中的getview方法的重写一直不太清楚.今天终于得以有空来探究它的详细机制. 下面先讲讲我遇到的几个问题: 一.View getview(int posit ...

  10. SQL数据库面试题以及答案

    Student(stuId,stuName,stuAge,stuSex) 学生表 stuId:学号:stuName:学生姓名:stuAge:学生年龄:stuSex:学生性别 Course(course ...