NSBundle.mainBundle().infoDictionary

iOS 8中带按钮的推送代码

  1. if ( UIDevice.currentDevice().systemVersion.hasPrefix("") ){
  2.  
  3. application.registerForRemoteNotificationTypes(UIRemoteNotificationType.Badge | UIRemoteNotificationType.Alert | UIRemoteNotificationType.Sound)
  4. }else {
  5.  
  6. var userNotificationAction = UIMutableUserNotificationAction()
  7. userNotificationAction.activationMode = .Foreground
  8. userNotificationAction.identifier = "identifier1"
  9. userNotificationAction.title = "打开程序"
  10.  
  11. var userNotiAction = UIMutableUserNotificationAction()
  12. userNotiAction.activationMode = .Background
  13. userNotiAction.identifier = "identifier2"
  14. userNotiAction.title = "发送消息"
  15. userNotiAction.authenticationRequired = false
  16. userNotiAction.destructive = true
  17.  
  18. var category = UIMutableUserNotificationCategory()
  19. category.identifier = "idCategory"
  20. category.setActions([userNotificationAction,userNotiAction], forContext: .Default)
  21.  
  22. var userNotiSet = UIUserNotificationSettings(forTypes: UIUserNotificationType.Sound | UIUserNotificationType.Alert | UIUserNotificationType.Badge , categories: NSSet(object: category))
  23. application.registerUserNotificationSettings(userNotiSet)
  24.  
  25. application.registerForRemoteNotifications()
  26. }

swift Code

category.identifier 服务器推送的json为

  1. {"aps":{"category":"idCategory","alert":"alert","badge":"","sound":"default"}}

之后会根据 推送的category 显示哪个UIMutableUserNotificationCategory,当点击UIMutableUserNotificationAction时调用

  1. func application(application: UIApplication, handleActionWithIdentifier identifier: String?, forRemoteNotification userInfo: [NSObject : AnyObject], completionHandler: () -> Void) {
  2.  
  3. println(identifier,userInfo)
  4.  
  5. if identifier == "identifier2" {
  6.  
  7. var dat = NSData(contentsOfURL: NSURL(string: "http://121.199.28.164/llc/api/?req=userList"))
  8. var str = NSString(data: dat, encoding: NSUTF8StringEncoding)
  9. println(str)
  10. }
  11.  
  12. completionHandler()
  13. }

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. AngularJS:实现动态添加输入控件功能(转)

    http://www.cnblogs.com/ilovewindy/p/3849428.html <!DOCTYPE html> <html> <head> < ...

  2. solr4.5 schema.xml配置文件

    schema.xml配置文件是用于定义index索引库的结构,有点类似于数据表表的定义. 当我们打开schema.xml配置文件时,也许会被里面密密麻麻的代码所吓倒,其实不必惊慌,里面其实就两个东西f ...

  3. centos系统常用软件环境搭建

    yum源制作grub常见问题:http://linux.chinaunix.net/techdoc/beginner/2008/01/04/975921.shtml 系统安装: 2 软件安装:yum ...

  4. [HTML Q&A][转]使pre的内容自动换行

    <pre> 元素可定义预格式化的文本.被包围在 pre 元素中的文本通常会保留空格和换行符.而文本也会呈现为等宽字体. <pre> 标签的一个常见应用就是用来表示计算机的源代码 ...

  5. POJ 1860 Currency Exchange

    题意:有n种货币,可以互相兑换,有m个兑换规则,兑换规则给出汇率r和手续费c,公式为b = (a - c) * r,从a货币兑换为b货币,问能不能通过不断的兑换赚钱,兑换期间手中的钱数不可以为负. 解 ...

  6. 如何进行Monkey Test

    如何进行Monkey Test   目录 一 简介 二 测试准备 三 基本命令格式 四 测试Log获取 五 Monkey命令参数介绍 六 保存monkey log以及手机log到sdcard(新增) ...

  7. Mondriaan's Dream(POJ 2411状态压缩dp)

    题意:用1*2的方格填充m*n的方格不能重叠,问有多少种填充方法 分析:dp[i][j]表示i行状态为j时的方案数,对于j,0表示该列竖放(影响下一行的该列),1表示横放成功(影响下一列)或上一列竖放 ...

  8. OpenGL超级宝典第5版&&基础渲染

    1.OpenGL查询拓展机制是否被支持 gltools函数库: int gltIsExtSupported(const char *extension) { #ifndef OPENGL_ES GLi ...

  9. bzoj 3091 城市旅行(LCT+数学分析)

    [题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=3091 [思路] 膜Popoqqq大爷的题解 click here [代码]是坑... ...

  10. [Hive - LanguageManual] Archiving for File Count Reduction

    Archiving for File Count Reduction Note: Archiving should be considered an advanced command due to t ...