Hello I am developing an Application in Mac using xcode objective-C language, how can I auto detect the http debuggers applications if open and close them instantly? this is what I found in some posts but I don`t have idea how to run it like looping while user is using the Application
if (state == UIApplicationStateBackground || state == UIApplicationStateInactive) {
// background
} else if (state == UIApplicationStateActive) {
// foreground
}```
Related
In native iOS, to authenticate a GameCenter player we call this just once:
GKLocalPlayer.LocalPlayer.AuthenticateHandler = delegate (UIViewController authenticationViewController, NSError error) // error is just to assist with debugging, eg error 5019 is no leaderboard setup in App Store Connect
{
// This is called multiple times:
// whenever app App is Foregrounded and Game Center player may have changed name or logged in or out
}
which all works fine.
However, in Unity I am calling this just once:
Social.localUser.Authenticate((bool success) =>
{
// This is only called once (eg with success=false if player is not logged in
});
But if I go to iPhone > Settings > Game Center and sign in then return to my game the callback is not called a second time.
So should Social.localUser.Authenticate be called every time the app is foregrounded?
I have an application and PUSHs work fine when the app is on background I tap on push notification and it redirects me - OK.
But here is the situation which i have to fix:
1 step: I open the app, working with it, it is active
2 step: notification comes but user is not seeing anything AND he gets redirected to another ViewController(according to push notification info) UNEXPECTEDLY.
I need the app NOT to redirect anywhere when it is active unless the push notification is actually tapped.
I found a solution!
in didReceiveRemoteNotification method add if statement:
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) {
if application.applicationState == .inactive || application.applicationState == .background {
//here add you actions
}
}
I write in Objective-C.
I'm using remote push up notification for app control. I don't want to disturb users with alerts and sounds when app is not active. What i need to do - if app is not active - do nothing when notification is recieved.
Thank you.
You want to send silent notifications. A notification sent without an aps key is silent. iOS will not play a sound, nor will it display a banner on the device. Your app will still receive such notifications, if it's running, and can respond as it chooses. If the app is in the background, it can display a local notification, or it can just ignore it.
Here are palyload structure which you need to receive for your case:
{
"aps" : {
"badge" : 5,
},
"acme1" : "bar",
"acme2" : [ "bang", "whiz" ]
}
BTWL: you can not mention badge as well, if you don't need it.
just add below code into your Appdelegate.m file
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
UIApplicationState state = [application applicationState];
if(state == UIApplicationStateActive)
{
//app in active mode
// add your code as you want to handle
}
else{
// app is in terminated mode
}
}
It was easier than i thought. Just no alert and sound elements in array in section aps.
No alert - nothing to show.
No sound - nothing to play.
I have create an application which is sending data to watch for showing.
When the watch is screen is active then it sending data perfectly, but when watch sleeps then an error occurred that device is not active.
My question is that when the watch is active any how it will get that data which send via using WKSession sendMessage method from my iPhone?
If the watch screen is off, the calling sendMessage on the iPhone won't work. You can only send data in real time when the watch screen is on. This is different than when you are using sendMessage from the watch to the iPhone (iPhone screen can be off). This is the block of code I use anytime I call sendMessage from my iPhone code:
// Send messages to any paired apple watch.
func tryWatchSendMessage(message: [String : AnyObject]) {
if self.session != nil && self.session.paired && self.session.watchAppInstalled {
self.session.sendMessage(message, replyHandler: nil) { (error) -> Void in
// If the message failed to send, queue it up for future transfer
self.session.transferUserInfo(message)
}
}
}
Then I setup the apple watch app to have the same handler if it gets the data via sendMessage or transferUserInfo.
I want to create a chat application in Titanium appcelerator using Strophe.js library. I have gone through strophe js libraries and their documents as well. I believe we can use strophe.js to build xmpp based chat app in web.
Thanks in advance, Can anyone please clarify the following doubts,
Is it possible to use strophe js inside our Titanium Appcelerator,If yes please suggest me how to use it. I tried to include the strophe js inside the titanium it shows can't find module error
Here's the code i tried with.
Ti.include("includes/strophe.js");
Ti.include("includes/strophe.register.js");
connection.register.connect("localhost:5280", callback, wait, hold);
var callback = function (status) {
if (status === Strophe.Status.REGISTER) {
connection.register.fields.username = "newuser";
connection.register.fields.password = "123456";
connection.register.submit();
} else if (status === Strophe.Status.REGISTERED) {
console.log("registered!");
connection.authenticate();
} else if (status === Strophe.Status.CONNECTED) {
console.log("logged in!");
} else {
// every other status a connection.connect would receive
}
};
$.index.open();
Can you please suggest to use any other libraries that can be used inside the Titanium Appceleartor to build chat application using XMPP
Looks like Strophe is created to be used inside browser and modifying it to work inside Titanium is rather risky.
The only XMPP module for Titanium, which I could find is titanium-xmpp on GitHub.