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. 2014-LAMP兄弟连视频下载地址汇总

    linux 兄弟连2014年新版Linux视频教程百度网盘下载 http://pan.baidu.com/s/1kTsjVfx http://pan.baidu.com/s/1sjJf2OX 兄弟连2 ...

  2. cocoapods 终极方案

    最近各种错误, 全部刷新 再说 sudo gem install -n /usr/local/bin cocoapods $ sudo gem update --system // 先更新gem $ ...

  3. 实现推送功能APP端需要完成的工作

    推送功能简介 实现推送的流程如下: 从APP注册推送功能,到APNS服务器发送推送消息给设备,有五个步骤. 一旦推送注册完成,应用自身的服务器以provider的身份提供推送. APP端实现 在代码方 ...

  4. 查看tablespace实际使用量和剩余空间

    到某表空间所有段的加和值,即按表空间分组统计dba_data_files.bytes-dba_free_space.bytes=dba_segments.bytesdba_segments中可查询已分 ...

  5. JS实现连接方式的菜单

    <html> <head><meta http-equiv="Content-Language" content="zh-cn"& ...

  6. 自己动手写路由器之ioctl获取网络接口信息

    最近打算写一个简单路由器,里面有用到ioctl获取网络接口信息,那就先把这部分单独拿出来说一说吧! ioctl这个函数,可以用来对特殊文件的基础设备参数进行操作,它们可以完成与打开文件描述符相关联的控 ...

  7. 正在连接...ORA-12541: TNS: 无监听程序

    明明已经在Net Configuration Assistant中配置过监听程序并启动过.但在测试本地网络服务名配置中扔提示以上错误"正在连接...ORA-12541: TNS: 无监听程序 ...

  8. C# chart控件绘制曲线

    在.NET中以前经常用GDI去绘制,虽然效果也不错,自从.NET 4.0开始,专门为绘制图表而生的Chart控件出现了,有了它,就可以轻松的绘制你所需要的曲线图.柱状图什么的了. using Syst ...

  9. 《Python CookBook2》 第一章 文本 - 测试一个对象是否是类字符串 && 字符串对齐

    测试一个对象是否是类字符串 任务 有时候需要测试一个对象,尤其是当你在写一个函数或者方法的时候,经常需要测试传入的参数是否是一个字符串. 解决方案 利用内建的isinstance 和basestrin ...

  10. IOS-day01_OC中类的创建以及使用

    OC中定义类 // 设计一个车类 @implementation Car : NSObject // 这个大括号里面写所有的属性 { @public int wheels ;//轮子个数 double ...