How to get unique identifiacation number of iphone - codenameone

I want to get unique id of iphone.currently I am using Display.getInstance().getUdid(); but it gives different unique id each time I install an application on iphone.
Can you please let me how to resolve it?

You can no longer get the Unique id per device because of apples revised security policy . identifierForVendor is the best alternative you can go for.
You can try
UIDevice *device = [UIDevice currentDevice];
NSString *currentDeviceId = [[device identifierForVendor]UUIDString];

getUDID() returns a faux number that can't be made unique due to Apple's restrictions.

You can get it by calling this function:
UIDevice.currentDevice().identifierForVendor

Related

Is it possible to have not-in array using swift and Firebase Firestore

So I tried to create a page to add new friends in my IOS swift app. So, I first tried where "id" is not in AllMyFriendsIds.
db.collection("users").whereField("id",notIn: MyFriends).limit(to: limit).getDocuments(completion: { [self](snap, err) in
But with more than ten friends the program crashed. Then I tried to do where "friends" array-not-content userId but this method doesn't exist.
Here is an example of the user's docs.
Here is the code that does not work so how to get all users that are not friend with us so where friends does not contain userId or where the docId or Id is not in an array(more than 10)
db.collection("users")
.whereField("friends",notIn: [UserDefaults().string(forKey: "userId")!])
.limit(to: limit)
.getDocuments(completion: {
My goal is to get users that are not my friends with the most efficient technique. Because I know how to do it by separating into groups of 10 but this technique is not efficient with reading and writing and cost a lot.

ProductProjectionByKeyGet not retrieving Channel Reference by Key

When getting product details by product key from commercetools, The response that I get does not have the Channel Key as channelId but instead I get a random UUID (I believe the reference id).
final ProductProjectionByKeyGet productProjectionByKeyGet =
ProductProjectionByKeyGet.of(productKey, ProductProjectionType.CURRENT)
.withExpansionPaths(product -> product.allVariants()
.attributes().valueSet());
return clientManager.getClientForProjectKey(ctAdapterProperties, projectKey)
.execute(productProjectionByKeyGet).toCompletableFuture().get();
In the response after getting product details, If we take a look into the property prices[].channel.id the value for it is a UUID but inside the commercetools, I have the channel key as a string like: <store>-<online>
prices={PriceDraftDsl[
channel=Reference{
typeId='channel',
id='b5c57a89-4f18-41eb-b5c3-e0de1c09cf81',
obj=null},
country=<null>,
custom=<null>,
customerGroup=<null>,
tiers=<null>,
validFrom=<null>,
validUntil=<null>,
value=USD 12]}
When I tried to do ProductSync with the above prices, I got the following error exception.
ReferenceResolutionException: Failed to resolve 'channel'
reference on PriceDraft with country:'null' and value: 'USD 12'.
Reason: Channel with key 'b5c57a89-4f18-41eb-b5c3-e0de1c09cf81'
does not exist.
Is there any way I can get the channel's key instead of a random UUID for channelId? and if not, Can I maybe get the channel details by using this ID?
I am currently using version 1.7.0 for commercetools-sync-java package.
I'm pretty new at this. Any help on this is deeply appreciated.
Thanks in advance!
Unfortunately, The product price does not contain channel key only a channel id.
The sync java library does provide channel key resolution and so it expects that your price draft will contain the key.
https://github.com/commercetools/commercetools-sync-java/blob/master/docs/usage/PRODUCT_SYNC.md#syncing-from-an-external-resource
Does that help?
Best Regards
Brian
You might also consider using the Import API
https://docs.commercetools.com/tutorials/import-and-export#import-api

Want to pass in a string array into a WS.sendRequest using groovy

I am new to API testing and am using Katalon to develop the tests. I've Googled any question I could think of and couldn't find anything to answer my question.
We have an API with the following Body
[
"${idValue1}",
"${idValue2}",
"${idValue3}",
"${idValue4}",
"${idValue5}",
]
I believe the purpose of this one is to delete multiple records at once by id. The script that we have in the step definition is
response = WS.sendRequest(findTestObject('EquipmentAPI/data-objects/DELETE Equipment By Ids', [('host') : GlobalVariable.host, ('idValues') : GlobalVariable.equipId]))
GlobalVariable.equipId = WS.getElementPropertyValue(response, 'data[0].id')
There are other step definitions that run before this one to set the Global Variables for use. I was able to generate the string array without issue.
Is this something that's possible? Please help!
Please let me know if further information is needed. Thanks.

Creating Relation one - to - one Parse User

I state that Parse.com use for my app
Does anyone know what 's the right way to create a list of friends?
The user must be able to create a relationship with another user.
I tried to take a look at AnyPic but I could not follow. seems very complicated for me ... I know there is the possibility of creating a relationship with PFRelation but did not find much nl web
Can you help?
Thank's Rory
If you want to have both sides be able to see the friendship you have two options:
duplicate the relationship, i.e. a PFRelation on each PFUser
us a many-to-many table, i.e. a new Class with two PFUser references, and possibly other information
Given that you might want more information about the relationship (e.g. status=requested/accepted/rejected, etc), I would suggest option two.
Here's a similar question on managing friend requests and friend lists using Parse.
then, I had to make a query where I drew all the posts of my users (Timeline) and their names ... I had a problem (same as what I here to do this' you suggested) or call in a query of the Pointer ...
I solved so
This is the content of the cell
NSString *user = [[object objectForKey:#"Utente"] valueForKey:#"Nome_Cognome"];
cell.FFNomeLabel.frame=CGRectMake(15, -35, 270, 100);
cell.FFNomeLabel.textAlignment = NSTextAlignmentRight;
cell.FFNomeLabel.text = user;
[cell.BiancaView addSubview:cell.FFNomeLabel];
NSString *img = [[object objectForKey:#"Utente"] valueForKey:#"foto"];
cell.FFImmagineUtente.file = (PFFile *)img;
cell.FFImmagineUtente.frame = CGRectMake(10, 10, 70, 70);
[cell.FFImmagineUtente.layer setMasksToBounds:YES];
[cell.FFImmagineUtente.layer setCornerRadius:35.3f];
cell.FFImmagineUtente.contentMode = UIViewContentModeScaleAspectFill;
[cell.FFImmagineUtente loadInBackground];
What do you think?
Also how can I save a pointer that is not a Current User?
I saw the documentation parse, but having little experience I was not entirely clear :)

one to many relationship in Objectify4

I am working with GAE with java. i am just creating a sample application with Student and Course relationships. I am having many branches and many students. Each branch can have many students, i tried like
ObjectifyService.register(Course.class);
ObjectifyService.register(Student.class);
Course course = new Course();
course.setName("ss");
course.setBranch("cs");
ofy().save().entity(course).now();
Student stu = new Student();
stu.setName("student1");
Key<Course> courseKey = new Key<Course>(Course.class, course.getId()); // getting error here
stu.setCourse(courseKey);
System.out.println("saving");
ofy().save().entity(stu).now();
I am not sure how to define this relationship in objecitfy4. I followed the tutorial http://www.eteration.com/objectify-an-easy-way-to-use-google-datastore/
Thanks.
Look at the Javadocs for Key. Instead of a public constructor, there is a more convenient creator method which requires less typing of <> generics:
Key<Course> courseKey = Key.create(Course.class, course.getId());
There are two keys that you might use:
first the GAE low-level com.google.appengine.api.datastore.Key and
second, the objectify's com.googlecode.objectify.Key.
You can use both with Objectify (as under the hood they are ultimately converted to low-level API).
Neither has a public constructor so you can not use new with them.
With low-level keys you'd use KeyFactory.createKey("Course", course.getId()).
With objectify key you'd use com.googlecode.objectify.Key.create(Course.class, course.getId())
When we use Objectify , if we need any Key to be created for condition(KeyFactory.createKey("Course", course.getId()) , In course object, Id field should be specified with index. It will work fine.

Resources