Nsbundle.mainbundle (). infodictionary
Push code with buttons in IOS 8
1 if(Uidevice.currentdevice (). Systemversion.hasprefix ("7") ){2 3Application.registerforremotenotificationtypes (Uiremotenotificationtype.badge | Uiremotenotificationtype.alert |uiremotenotificationtype.sound)4}Else {5 6var usernotificationaction =uimutableusernotificationaction ()7Usernotificationaction.activationmode = . Foreground8Usernotificationaction.identifier ="Identifier1"9Usernotificationaction.title ="Open Program"Ten Onevar usernotiaction =uimutableusernotificationaction () AUsernotiaction.activationmode = . Background -Usernotiaction.identifier ="Identifier2" -Usernotiaction.title ="Send Message" theusernotiaction.authenticationrequired =false -Usernotiaction.destructive =true - - +var category =uimutableusernotificationcategory () -Category.identifier ="idcategory" + category.setactions ([usernotificationaction,usernotiaction], Forcontext:. Default) A atvar usernotiset = uiusernotificationsettings (ForTypes:UIUserNotificationType.Sound | Uiusernotificationtype.alert | Uiusernotificationtype.badge, Categories:nsset (Object: category)) - application.registerusernotificationsettings (Usernotiset) - - application.registerforremotenotifications () -}Swift Code
Category. the JSON that the identifier server pushes is
{"APS":{"category":"idcategory","Alert":"Alert","badge":"1"," Sound":"default"}}
it will then show which uimutableusernotificationcategoryaccording to the category of the push, when clicking uimutableusernotificationaction called when
1Func application (application:uiapplication, Handleactionwithidentifier identifier:string?, forRemoteNotification UserInfo: [Nsobject:anyobject], Completionhandler: ()Void) {2 3 println (identifier,userinfo)4 5 ifidentifier = ="Identifier2" {6 7var dat = NSData (Contentsofurl:nsurl (string:"http://121.199.28.164/llc/api/?req=userList"))8var str =NSString (Data:dat, encoding:nsutf8stringencoding)9 println (str)Ten } One A Completionhandler () -}Swift Code
Beautifully crafted UI components in IOS 8 using swift and Xcode 6
Http://www.cocoachina.com/industry/20140619/8883.html
1. Send the request by POST:
Http://itunes.apple.com/search?term= your application name &entity=software
2, more simple request, according to AppID, query return results
Http://itunes.apple.com/lookup?id=[appid]
{
Resultcount = 1;
Results = (
{
ArtistID = Developer ID;
artistname = developer Name;
Price = 0;
isgamecenterenabled = 0;
kind = software;
LANGUAGECODESISO2A = (
En
);
Trackcensoredname = review name;
Trackcontentrating = rating;
TrackID = Application ID;
TrackName = Application Name ";
Trackviewurl = Application Introduction URL;
Userratingcount = user Rating;
Userratingcountforcurrentversion = 1;
Version = revision number;
Wrappertype = software;
}
);
}
Ios8,xcode6 around