Swift local notification icon badge number not incrementing - uilocalnotification

I have a problem.
my app icon badge is not incrementing when a notification fires. i can only set
localNotification.applicationIconBadgeNumber
to 0 or 1.
if i set
localNotification.applicationIconBadgeNumber = localNotification.applicationIconBadgeNumber + 1
Badge number updates only the first time, and then remain at its value.
There is a method to increment that value?i have searched internet but i can't figure out how solve this problem.
thank you in advance!

Try to set that badge number with the UIApplication singleton object, instead of assigning a counter to a local notification.

Just check out my answer on this topic:
https://stackoverflow.com/a/55615254/11340995
The secret is to increment

Related

How do I perform math using TinyDB? (App Inventor 2)

I am trying to use TinyDB in order to store a value on one screen and display it on another. On the second screen, I want to add 1 to the number stored with TinyDB on the first screen. However, when I try to do this, nothing happens. What am I doing wrong?
Here's my code for the two screens.
Screen1
Screen2
You already loaded the available computers in Screen2.Initialize into label computersAvail.Text. Therefore in the Button1.Click event first add 1 like this
set computersAvail.Text to get computersAvail.Text + 1
and to store the updated available computers in TinyDB then use the following block
TinyDB.StoreValue "Computers"
get computersAvail.Text
btw. it helps to first do the tutorials to learn the basics of App Inventor...
also see this link for "the lost souls"...

How to get constant feedback from a slider in Xcode with ApplescriptObjC?

I'm new to ApplescriptObjC as you'll probably see if you keep reading. I was wondering how to get constant feedback from a slider so that as soon as its value is 1 it runs script A and as soon as its value is changed to 0, it runs script B.
I know you can have actions for buttons like:
on buttonClicked_(sender)
do action
end buttonClicked_
But how can I have a one that constantly checks for a change in the slider's value and does the appropriate action? Is it similar to connecting a slider to a text box with the getStringValueFrom() thing?
Any help would be appreciated. Thanks :)
Found out how!
turns out on action_(sender) will work for sliders as well. They send the signal every time the item is clicked on and released whether a change exists or not. Then its a simple matter of an if statement to run two different series of actions depending on the value the slider was set to.

NSPopUpButton set it to the first item

I have a clear button in my Mac OS app.
When the button is pressed, it clears all the values of the form and resets the NSPopUpButton to the first item.
The question is how do I change the NSPopUpButton control with code.
Thanks
You can call:
Objective C:
[myPopupButton selectItemAtIndex:0]
Swift:
myPopupButton.selectItem(at: 0)
See here for details.
When argument is 0 it means nil, and that works. If you put other number (for example 2 ) this will not work because the argument is not number!!!

AppleScriptObjC: ProgressBar does not increment

I am trying to implement a Progress bar update in AppleScriptObjC. I have connected the progressbar thru IB and trying to increment the Progressbar update via incrementBy(5). The Inderterminate property is set to false. the IB connection is fine because if I set the Inderterminate to true and uncomemnt the code to start/stop animation it works fine. this is the Error I get "-[NSProgressIndicator incrementby:]: unrecognized selector sent to instance 0x2007e2220"
following is the code
property ProgressBar : missing value
on MyBtnClick_(sender)
(*.. some code ..*)
ProgressBar's incrementby_(5)
ProgressBar's displayifNeeded()
--ProgressBar's startAnimation_(me)
--ProgressBar's stopAnimation_(me)
end MyBtnClick_
Thanks in Adv for any pointers.
regards,
Jesse
Try incrementBy_ -- case matters.
Ok so, "unrecognized selector sent to instance" means that the command sent is unknown so the command your sending to it means it does not exist, however If you are trying to send a message to make the progress bar to set its progress % then, i can help you! :D, I use the "setDoubleValue" command to set the Progress bars status and you don't need to startAnimation and stopAnimation it either :D
ok so here is a script that will store the current progress and when MyBtnClick is run, it will add 5% to the progress bar
property ProgressBar : missing value
property currentProgress : 0
on MyBtnClick_(sender)
(*.. some code ..*)
set currentProgress to currentProgress + 5
ProgressBar's setDoubleValue_(currentProgress)
end MyBtnClick_
hope this helps :D

Change value of label in Xcode

I'm new in Xcode. I want to make a Progress View and below is a label. This label can change value from 1 to 100 just the same when the progress run. For example: when i tap the "Start" button then the progress run from 1 to 100, so does the label run from 1 to 100. Absolutely, i want to see to value change 1,2,3,4... of the label. Can anyone help me?
Code details attached is good. Thanks!
You can use this logic to get your answer.

Resources