apps (including the MyApp we just created) to open WXApp, we need to add a URL Schemes for the WXApp. Step: Select WXApp project-> Info-> URL Types-> click "+"-> Fill in the URL Schemes Columnweixin
Add a URL Schemes
Note: An application can have multiple URL Schemes. You can click "+" again to add a URL Schemes
Let's take a look at what is in the info. plist file.
URL Schemes in the info. plist File
Run WXApp. (Note which target is your run target)
Run WXApp in the simulator
In this way, WXApp
(Download the generated certificate that supports the push service.) )3, Pushtestdescdevprofile.mobileprovision 4, PUSHTEST.P12This completes the IOS message push (Java background) certificate.The following code begins:Five, the iOS port code:1, first in the project APPDELEGATE.M to add the following two agent methods-(void) Application: (UIApplication *) application Didregisterforremotenotificationswithdevicetoken: (NSData *) Devicetoken {NSString *
An event-triggered call in the iOS Appdelegate methodReference: http://blog.sina.com.cn/s/blog_a573f7990101bphp.html//when an application is about to go into an inactive state, during which time the application does not accept messages or events, such as incoming calls- (void) Applicationwillresignactive: (UIApplication *) Application {NSLog (@"the application is going to be inactive and will be entering the background"); } //The application is run
Function: CallMethod 1:Nsurl *url = [Nsurl urlwithstring:@ "tel://10010"];[[UIApplication sharedapplication] openurl:url];Pros: Jump directly to the dial-up interface, the simplest and most straightforward. Disadvantage: After the call is finished, will not automatically return to the original application, directly stay in the call record interface.Method 2:if (_webview = = nil){_webview = [[UIWebView alloc] initWithFrame:self.view.bounds];}[_webview
) program is in the background and can execute code, and most programs will stay in this state for a while after entering this state. When the time is up, it will enter the suspend state (Suspended). Some programs can be in Background state for a long time after special requests.
The Suspended (pending) program cannot execute code in the background. The system automatically turns the program into this state and no more notifications. When suspended, the program is still stuck in memory when
Swift notification Creation
Create a singleview Application
Open appdelegate. Swift and go to
Application (Application: uiapplication, didfinishlaunchingwitexceptions launchoptions: nsdictionary ?)
Input code:
Func application (Application: uiapplication, didfinishlaunchingwitexceptions launchoptions: nsdictionary ?) -> Bool {
// Set the Notification Type
Let types: uiusernotificationtype = uiusernotifi
IOS-Runtime: shortcuts to page Jump, ios-runtime jumpPreface
During the webpage jump, if the current class is not UIViewcontroller (which is represented by VC below), will you write a proxy or block it to the VC to pass the information, and then perform
/// Assume that targetVc is the page to jump to [self. navigationController pushViewController: targetVc animated: YES];
TableViewCell is used as an example. If there are many such operations in tableViewCell displayed on each page, many proxies
viewWillAppear:animated]; self.numberLable.text=[check shareDataModle].Lable; self.danHao.text = [check shareDataModle].Text; }
3. Use [[UIApplication sharedApplication] openURL:] to load other applications in iOS development
In iOS development, you often need to call other apps, such as making phone calls and sending emails. UIApplication: openURL: The method is the simplest way to achieve th
certificate has been exported.
So far, we have generated four files:
1. PushTest. certSigningRequest
2. aps_development-6.cer (download the generated certificate that supports PUSH Service .)
3. pushtestdescDevprofile. mobileprovision 4. PushTest. p12
So far, all the IOS message push (JAVA background) certificates have been created.
Start the code below:
V. IOS code:
1. First, add the following two proxy methods to the project's AppDelegate. m:
-(Void) application :(
the notification to request the user to allow the notification; once the registration method is called, the application's-(void) application :( UIApplication *) application didRegisterUserNotificationSettings :( UIUserNotificationSettings *) notificationSettings proxy method will be called no matter whether the user chooses to allow the notification, in this method, based on the user's choice: if the notification is allowed, the notification will be
while. after the time is reached, it will be Suspended ). some programs can be in the Background state for a long time after special requests. the sushortded (Suspended) program cannot execute code in the background. the system will automatically turn the program into this state and will not send any notifications. when suspended, the program remains in the memory, and the life cycle of the application state in the program memory
This method is called when the iOS app is loaded and the app is a
the simulated object is actually calledopenURLMethod to open the correct URL.
Suppose this object has the following method:
@interface AppLinker : NSObject - (instancetype)initWithApplication:(UIApplication *)application; - (void)doSomething:(NSURL *)url;@end
This is a very far-fetched example, but please tolerate me. In this example, you will notice that we use the constructor for injection. When we createAppLinkerWhenUIApplicationObje
, hasAction, alertLaunchImage, applicationIconBadgeNumber, soundName, and userInfo.
1. First, you need to understand the difference between the simulator and the real machine: The simulator will not receive audio prompts, And the simulator will not detect the possibility of receiving notifications. So let me add a few points:
1. Add monitoring notification:
if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)])
Ios-pushnotification learning and summarization (push mechanism)
Step 2: Find a demo to learn about: a demo I found on github
Https://github.com/Turkcell/PushNotification_iOS_sdk
Do the following in the Code:
# Pragma mark -------- remote notification-(void) registerAPNSNotification {// applicable to 8.0, IF going 8.0 if (! [[NSUserDefaults standardUserDefaults] boolForKey: role]) {if ([[UIApplication sharedApplication] respondsToSelector: @ select
. 1 #import int Main (int argc, char *argv[]) 3 { 4 nsautoreleasepool *pool = [[ NSAutoreleasePool alloc] init]; 5 int retVal = Uiapplicationmain (argc, argv, nil, nil); 6 [pool release]; 7 return RetVal; 8 } The main () function accomplishes the following 3 tasks:(1) Create an automatic release pool ;(2) Call the Uiapplicationmain () function;(3) Release the auto-release pool .In general, developers do not need to modify the main () function.The function Uiapplicationmain
Framework
Cocos2d sources: stores cocos2d source code
Classes: stores the source code of this application.
Other sources: main function of the program entry
Resources: Stores project images, icons, sound files, etc.
Frameworks: Framework
Start ProcessInt main (INT argc, char * argv []) {
NSAID utoreleasepool * Pool = [NSAID utoreleasepool new]; // control of the program is passed to the application proxy object xappdelegate
Int retval = uiapplicationmain (argc, argv, nil, @ "xxappdelegate"); [p
If you want to be compatible with IOS8 for local push in iOS, it is important to note that iOS8 should be registered with the following statement when implementing a local push.[[uiapplication sharedapplication] registerusernotificationsettings:mysettings];As for the IOS8 version of the practice is not much to say, directly on the code. Create a new OC class file (Notificationhelper) and declare the relevant method in NotificationHelper.h as follows:#
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.