Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: id as a string instead of only integers

See original GitHub issue

Your Environment

Not relevant

Plugin config

Not relevant

Expected Behavior

Allow id’s of the notification to be a string? A typical scenario would be a room id in a chat application with a unique hashkey that I would like the notifications id to be equal to

Actual Behavior

errors with Id is not a number:

Steps to Reproduce

Set the id of a notification to some string e.g. “awkopa2002”


Trying to set the notification id to be a string

Debug logs

Not relevant

Include iOS / Android logs

Not relevant

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

rwillettcommented, Mar 13, 2017

The point is that the plugin is being wholly rewritten for IOS10. That is a considerable undertaking.

Adding in functionality that isn’t really necessary and that is trivial to implement in a simple JavaScript wrapper, is not a good use of peoples time.

We manage dozens of notifications being set, changed, queried, reset, rescheduled every day all through a simple service which keeps everything unique and allows us to refer to notifications by name. I wrote it, so I know that its not difficult to do. We put it together in a morning from memory. In the grand scheme of ‘hard things’ to do, keeping track of notifications by a unique user defined name, isn’t difficult.

rwillettcommented, Mar 14, 2017

Why are you creating a hash function? There are masses of libraries that do this for nothing which are cryptographically correct. Most people (myself included) do not have the skills to write hashes that work properly.

But why do you need a hash function anyway? You have a unique name, a chat room, so why do you have to make it difficult by making a cryptographic hash (or non cryptographic hash).

You only have 64 local notifications to use anyway on IOS, writing a hash function for 64 local notifications is a little overkill.

We use a simple integer increment for all local notifications. We have a service that all the local notifications call that gets the next available unique integer. We query the local notifications when we start up, make sure that if we have any local notifications, the unique integer is greater than the greatest number from the query. This guarantees uniqueness, we then use a simple JavaScript associative array to link names to unique integers.

Thats simple, it’s easy, it works, there is no cryptographic hash needed.

Why are you making it difficult for yourself?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature id can only be positive integer when using feature-state
I think the docs are saying that id can only be a number or a string that can be casted to a number,...
Read more >
HTML input type="number" still returning a string when ...
In other words, type="number" is a hint to implement client-side validation and appropriate GUI controls but the underlying element will still store strings....
Read more >
Hashids - generate short unique ids from integers
Hashids is a small open-source library that generates short, unique, non-sequential ids from numbers. It converts numbers like 347 into strings like “yr8”,...
Read more >
How To: Convert a string field to a numeric field - Esri Support
Right-click the newly created field's header and select Field Calculator. If the string field contains only numeric values, use the following ...
Read more >
Model Binding in ASP.NET Core | Microsoft Learn
Looks through the available sources in the HTTP request and finds id = "2" in route data. Converts the string "2" into integer...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found