跳转至

【What is iMessage Apple Push】

【What is iMessage Apple Push】Apple Calendar Push APNS (ApplePushNotificationService) is an Apple message push server

iMessage is a newly launched APPEXtension in iOS10. It can add our own content to system application messages, send them to friends, and even operate with your friends in the same message. This article mainly discusses how to quickly integrate emoticons in iMessage. APPEXTENSION and host APP have their own independent spaces, so IMessageExtension can also exist alone, or it can be packaged with the host APP and uploaded to the same project, and users can download iMessageApp (Download) or host App in iMessagestore) Or after the host App (in the AppStore) is downloaded, another one will be automatically downloaded. 1. Templates utilizing X code IMESSAGEEXTENSITION IMESSAGESDK have been integrated in iOS10, so the required X code version must be X-Code8+. Select File->New->Project->Application->StickerPackApplication as shown: When completed, the project layout is very simple and has no classes, so we don't have to write any code. , the system will automatically generate @2x and @1x. 2. Custom tags If the template provided by X code cannot meet our needs, you can use the custom mode. Compared to the X code template, select "File" -> "New" -> "Project" -> "Application" -> "iMessageApplication". Projects built using this method also have a folder called MessgaeExtension. But there is no StickerPack folder in Assets.xcassets. package com.staticTest;

/**

  • Test the execution sequence of dynamic code blocks

    1. The only classes that can be modified by static are static external classes
    1. Static methods cannot directly access non-static members (methods, member variables)
    1. The static code block is loaded directly when the class is loaded and is only executed once.
    1. Execution order: parent class static code block and static members -->
  • Subclass static code blocks and static members -->

  • Parent class code block -->

  • Parent class construction method -->

  • Subclass code block -->

  • Subclass construction method -->

*

  • @author liu

*

*/

public class StaticTest {

 static{

     System.out.println("Parent class static code block");

 }





 public StaticTest(){

     System.out.println("Parent class constructor");

 }

 {

     System.out.println("Parent class code block");

 }



 public static void main(String[] args) {

     new child();

 }

}

class child extends StaticTest{

 static{

     System.out.println("Subclass static code block");

 }



 {

     System.out.println("Subclass code block");

 }



 public child(){

     System.out.println("Subclass constructor");

 }

}

So if you use custom tags, you don't need to add emoticons in Assets.xcassets. You can put resource files into our project. Just one MessageViewControlle is not enough. Custom stickers require MSStickerBrowserViewController, and our resource files are also loaded through this class. You can think of MessageViewControlle as a ViewControlle and MSStickerBrowserViewController as a UITableViewController. Therefore, we need to create a view controller that inherits from MSStickerBrowserViewController and if its name is: MyStickerBrowserViewController #import @Array = [NSMutableArrayarray]; self.stickerBrowserView.dataSource = self; for (inti = 1; i<TOTAL_STICKER;i+ +) {NSString nameStr = [NSStringstringWithFormat:@"bh_%d",i]; NSURL url = [[NSBundlemainBundle] URLForResource:nameStrwithExtension:@"png"]; MSSticker *sticker = [[MSStickeralloc] initWithContentsOfFileURL:urllocalizedDescription: @""Error: None]; [self.dateArrayaddObject: Sticker];}}-(void)viewDidLoad

{[superviewDidLoad]; [self.stickerBrowserViewreloadData]; //Data source has been loaded, refresh interface [This is just a demonstration, actual process data is being loaded, you can start sub-thread processing as needed]) 123456789101112131415415171171819 Complete protocol - (NSInteger) numberOfStickersInStickerBrowserView: (MSStickerBrowserView ) StickerBrowserView {returnself.dateArray.count;} - (MSSticker )serViewController into MessageViewController. self.stickBrowserViewController = [[[MyStickBrowserViewControlleralloc] initWithStickerSize:MSStickerSizeSmall]; [selfaddChildViewController:self.stickBrowserViewController]; [self.viewaddSubview:self.stickBrowserViewController.view]