Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6763173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:26:41+00:00 2026-05-26T14:26:41+00:00

I am showcasing content in my iOS app and I would like users to

  • 0

I am showcasing content in my iOS app and I would like users to be able to vote. Instead of implementing a complicated “register a username” functionality, I just want a user to be able to upvote.
In the World of web development I could prevent duplicate votes by using the IP address of the client.

How can I make a simple voting system that allows a user to be only able to vote up a post once and not worry about duplicates?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:26:41+00:00Added an answer on May 26, 2026 at 2:26 pm

    Dont use uniqueIdentifier as Apple has stated:

    Deprecated in iOS 5.0

    uniqueIdentifier

    An alphanumeric string unique to each device based on
    various hardware details. (read-only) (Deprecated in iOS 5.0. Instead,
    create a unique identifier specific to your app.)

    Instead, I would suggest changing over from uniqueIdentifier to this open source library (2 simple categories really). It utilizes the device’s MAC Address along with the App Bundle Identifier to generate a unique ID in your applications that can be used as a UDID replacement.

    Keep in mind that unlike the UDID this number will be different for every app.

    You simply need to import the included NSString and UIDevice categories and call:

    #import "UIDevice+IdentifierAddition.h"
    #import "NSString+MD5Addition.h"
    NSString *iosFiveUDID = [[UIDevice currentDevice] uniqueDeviceIdentifier]
    

    You can find it on Github here:

    https://github.com/gekitz/UIDevice-with-UniqueIdentifier-for-iOS-5


    Heres the code (just the .m files – check the github project for the headers):

    UIDevice+IdentifierAddition.m

    #import "UIDevice+IdentifierAddition.h"
    #import "NSString+MD5Addition.h"
    
    #include <sys/socket.h> // Per msqr
    #include <sys/sysctl.h>
    #include <net/if.h>
    #include <net/if_dl.h>
    
    @interface UIDevice(Private)
    
    - (NSString *) macaddress;
    
    @end
    
    @implementation UIDevice (IdentifierAddition)
    
    ////////////////////////////////////////////////////////////////////////////////
    #pragma mark -
    #pragma mark Private Methods
    
    // Return the local MAC addy
    // Courtesy of FreeBSD hackers email list
    // Accidentally munged during previous update. Fixed thanks to erica sadun & mlamb.
    - (NSString *) macaddress{
        
        int                 mib[6];
        size_t              len;
        char                *buf;
        unsigned char       *ptr;
        struct if_msghdr    *ifm;
        struct sockaddr_dl  *sdl;
        
        mib[0] = CTL_NET;
        mib[1] = AF_ROUTE;
        mib[2] = 0;
        mib[3] = AF_LINK;
        mib[4] = NET_RT_IFLIST;
        
        if ((mib[5] = if_nametoindex("en0")) == 0) {
            printf("Error: if_nametoindex error\n");
            return NULL;
        }
        
        if (sysctl(mib, 6, NULL, &len, NULL, 0) < 0) {
            printf("Error: sysctl, take 1\n");
            return NULL;
        }
        
        if ((buf = malloc(len)) == NULL) {
            printf("Could not allocate memory. error!\n");
            return NULL;
        }
        
        if (sysctl(mib, 6, buf, &len, NULL, 0) < 0) {
            printf("Error: sysctl, take 2");
            return NULL;
        }
        
        ifm = (struct if_msghdr *)buf;
        sdl = (struct sockaddr_dl *)(ifm + 1);
        ptr = (unsigned char *)LLADDR(sdl);
        NSString *outstring = [NSString stringWithFormat:@"%02X:%02X:%02X:%02X:%02X:%02X", 
                               *ptr, *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4), *(ptr+5)];
        free(buf);
        
        return outstring;
    }
    
    ////////////////////////////////////////////////////////////////////////////////
    #pragma mark -
    #pragma mark Public Methods
    
    - (NSString *) uniqueDeviceIdentifier{
        NSString *macaddress = [[UIDevice currentDevice] macaddress];
        NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];  
        NSString *stringToHash = [NSString stringWithFormat:@"%@%@",macaddress,bundleIdentifier];
        NSString *uniqueIdentifier = [stringToHash stringFromMD5];  
        return uniqueIdentifier;
    }
    
    - (NSString *) uniqueGlobalDeviceIdentifier{
        NSString *macaddress = [[UIDevice currentDevice] macaddress];
        NSString *uniqueIdentifier = [macaddress stringFromMD5];    
        return uniqueIdentifier;
    }
    
    @end
    

    NSString+MD5Addition.m:

    #import "NSString+MD5Addition.h"
    #import <CommonCrypto/CommonDigest.h>
    
    @implementation NSString(MD5Addition)
    
    - (NSString *) stringFromMD5{
        
        if(self == nil || [self length] == 0)
            return nil;
        
        const char *value = [self UTF8String];
        
        unsigned char outputBuffer[CC_MD5_DIGEST_LENGTH];
        CC_MD5(value, strlen(value), outputBuffer);
        
        NSMutableString *outputString = [[NSMutableString alloc] initWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
        for(NSInteger count = 0; count < CC_MD5_DIGEST_LENGTH; count++){
            [outputString appendFormat:@"%02x",outputBuffer[count]];
        }
        return [outputString autorelease];
    }
    
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi Does anyone know of an app built using( or showcasing the use of)
Background : I'm currently, for my University, creating some simple apps showcasing the possible
Hi. I'm building a web site that's showcasing a large amount of products. I
I was looking at some demos over at Apple showcasing some cool HTML5, CSS3
I am trying to write a Java application showcasing Bluetooth features. On general search,
Below are three pictures showcasing the problem. I will go into more detail right
I want to put some compressed data into a remote repository. To put data
Hello StackOV experts! I've just completed the core pieces of my first MVC3 site.
I have the following piece of code which is not working the way I
$(#ShowRating).html($.get(url)); This is not working, in fact firebug doesn't even show any headers... what

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.