{"id":13743082,"url":"https://github.com/fabiocaccamo/FCUUID","last_synced_at":"2025-05-09T00:32:37.356Z","repository":{"id":37385072,"uuid":"24844442","full_name":"fabiocaccamo/FCUUID","owner":"fabiocaccamo","description":":iphone: :id:  iOS UUID / Universally Unique Identifiers library as alternative to UDID and identifierForVendor.","archived":false,"fork":false,"pushed_at":"2024-06-14T01:52:21.000Z","size":64,"stargazers_count":1629,"open_issues_count":3,"forks_count":226,"subscribers_count":56,"default_branch":"master","last_synced_at":"2025-05-03T01:46:06.041Z","etag":null,"topics":["device","device-uuid","icloud","identifierforvendor","installation","ios","keychain","objective-c","persistence","pod","session","udid","uickeychainstore","unique-identifier","uuid","uuids","vendor"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fabiocaccamo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["fabiocaccamo"],"ko_fi":"fabiocaccamo","liberapay":"fabiocaccamo","custom":["https://www.buymeacoffee.com/fabiocaccamo","https://www.paypal.me/fabiocaccamo"]}},"created_at":"2014-10-06T12:15:00.000Z","updated_at":"2025-04-28T06:07:00.000Z","dependencies_parsed_at":"2025-01-08T23:21:14.290Z","dependency_job_id":null,"html_url":"https://github.com/fabiocaccamo/FCUUID","commit_stats":{"total_commits":68,"total_committers":5,"mean_commits":13.6,"dds":0.08823529411764708,"last_synced_commit":"0f3ceeba27cdae9ccf36aa1d7ce3c54b422c477d"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiocaccamo%2FFCUUID","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiocaccamo%2FFCUUID/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiocaccamo%2FFCUUID/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiocaccamo%2FFCUUID/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabiocaccamo","download_url":"https://codeload.github.com/fabiocaccamo/FCUUID/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253171163,"owners_count":21865275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["device","device-uuid","icloud","identifierforvendor","installation","ios","keychain","objective-c","persistence","pod","session","udid","uickeychainstore","unique-identifier","uuid","uuids","vendor"],"created_at":"2024-08-03T05:00:40.131Z","updated_at":"2025-05-09T00:32:37.126Z","avatar_url":"https://github.com/fabiocaccamo.png","language":"Objective-C","readme":"FCUUID ![Pod version](http://img.shields.io/cocoapods/v/FCUUID.svg) ![Pod platforms](http://img.shields.io/cocoapods/p/FCUUID.svg) ![Pod license](http://img.shields.io/cocoapods/l/FCUUID.svg)\n===================\niOS **UUID** library as alternative to the old good **UDID** and **identifierForVendor**.\nThis library provides the simplest API to obtain **universally unique identifiers with different levels of [persistence](#persistence)**.\n\nIt's possible to retrieve the **UUIDs created for all devices of the same user**, in this way with a little bit of server-side help **it's possible manage guest accounts across multiple devices easily.**\n\n## Requirements \u0026 dependencies\n- iOS \u003e= 5.0\n- ARC enabled\n- Key-value storage enabled *(target / Capabilities / iCloud / Key-value storage)*\n- Security.framework\n- [UICKeyChainStore](https://github.com/kishikawakatsumi/UICKeyChainStore)\n- ***(optional)*** - Key-value storage enabled -\u003e Target / Capabilities / iCloud / Key-value storage enabled if you want to **share** `uuidsOfUserDevices` values **across multiple devices using the same iCloud account**.\n- ***(optional)*** - KeyChain sharing enabled (entitlements and provisioning profile) if you need to **share** the same `uuidForDevice` / `uuidsOfUserDevices` values **across multiple apps with the same bundle seed**.\n\n## Installation\n\n#### CocoaPods:\n`pod 'FCUUID'`\n\n#### [Swift Package Manager](https://github.com/apple/swift-package-manager):\n1. File \u003e Swift Packages \u003e Add Package Dependency\n2. Add https://github.com/fabiocaccamo/FCUUID\n3. Select \"Up to Next Major\" with \"1.0.0\"\n\n#### [Carthage](https://github.com/Carthage/Carthage):\n\n```ogdl\ngithub \"fabiocaccamo/FCUUID\"\n```\n\n#### Manual install:\n- Copy `FCUUID` folder to your project.\n- Manual install [UICKeyChainStore](https://github.com/kishikawakatsumi/UICKeyChainStore)\n\n### Optional setup:\nIt is recommended to do the setup in `applicationDidFinishLaunchingWithOptions` method.\n- Add an observer to the `FCUUIDsOfUserDevicesDidChangeNotification` to be notified about uuids of user devices changes.\n- If necessary, **migrate from a previously used UUID or UDID** using one of the migrations methods listed in the API section (it's recommended to do migration before calling `uuidForDevice` or `uuidsForUserDevices` methods). Keep in mind that **migration works only if the existing value is a valid uuid and `uuidForDevice` has not been created yet**.\n- Call any class method to enforce iCloud sync.\n\n## API\n**Get different UUIDs** (each one with its own persistency level)\n\n```objective-c\n//changes each time (no persistent)\n+(NSString *)uuid;\n\n//changes each time (no persistent), but allows to keep in memory more temporary uuids\n+(NSString *)uuidForKey:(id\u003cNSCopying\u003e)key;\n\n//changes each time the app gets launched (persistent to session)\n+(NSString *)uuidForSession;\n\n//changes each time the app gets installed (persistent to installation)\n+(NSString *)uuidForInstallation;\n\n//changes each time all the apps of the same vendor are uninstalled (this works exactly as identifierForVendor)\n+(NSString *)uuidForVendor;\n\n//changes only on system reset, this is the best replacement to the good old udid (persistent to device)\n+(NSString *)uuidForDevice;\n//or\n#import \"UIDevice+FCUUID.h\"\n[[UIDevice currentDevice] uuid];\n```\n**Get the list of UUIDs of user devices**\n```objective-c\n//returns the list of all uuidForDevice of the same user, in this way it's possible manage guest accounts across multiple devices easily\n+(NSArray *)uuidsOfUserDevices;\n```\n**Migrate from a previously stored UUID / UDID**\nBefore migrating an existing value it's recommended to **debug it** by simply passing `commitMigration:NO` and logging the returned value.\nWhen you will be ready for committing the migration, use `commitMigration:YES`.\nAfter the migration, any future call to `uuidForDevice` will return the migrated value.\n```objective-c\n//these methods search for an existing UUID / UDID stored in the KeyChain or in UserDefaults for the given key / service / access-group\n+(NSString *)uuidForDeviceMigratingValue:(NSString *)value commitMigration:(BOOL)commitMigration;\n+(NSString *)uuidForDeviceMigratingValueForKey:(NSString *)key commitMigration:(BOOL)commitMigration;\n+(NSString *)uuidForDeviceMigratingValueForKey:(NSString *)key service:(NSString *)service commitMigration:(BOOL)commitMigration;\n+(NSString *)uuidForDeviceMigratingValueForKey:(NSString *)key service:(NSString *)service accessGroup:(NSString *)accessGroup commitMigration:(BOOL)commitMigration;\n```\n**Check if value is a valid UUID**\n```objective-c\n+(BOOL)uuidValueIsValid:(NSString *)uuidValue;\n```\n\n## Persistence\n- **`√`** *yes*\n- `-` *no*\n- **`*`** *read notes below*\n\n| PERSISTS              | App memory | App relaunch | Reset Advertising Identifier | App reinstall | System reboot | System upgrade | System reset |\n|-----------------------|:----------:|:------------:|:----------------------------:|:-------------:|:-------------:|:--------------:|:------------:|\n| `uuid`                |      -     |       -      |               -              |       -       |       -       |        -       |       -      |\n| `uuidForKey:key`      |    **√**   |       -      |               -              |       -       |       -       |        -       |       -      |\n| `uuidForSession`      |    **√**   |       -      |               -              |       -       |       -       |        -       |       -      |\n| `uuidForInstallation` |    **√**   |     **√**    |             **√**            |       -       |     **√**     |        -       |       -      |\n| `uuidForVendor`       |    **√**   |     **√**    |               -              |     **√***    |     **√**     |        -       |       -      |\n| `uuidForDevice`       |    **√**   |     **√**    |             **√**            |     **√**     |     **√**     |      **√**     |    **√****   |\n\n**(persists only if the user have not uninstalled all apps of the same vendor)*\n\n***(persists only if the user restores a device backup which includes also keychain's data)*\n\n## FAQ\n#### How can I share the device uuid between two apps?\nYou must have **KeyChain sharing enabled** (entitlements and provisioning profile) and your apps identifiers must have the same bundle seed.\n\n#### What happens if I call `uuidForDevice` on 2 different devices using same iCloud account and iCloud Keychain?\nYou will obtain 2 **different uuid(s)**, and if you call `uuidsOfUserDevices` you will obtain a list containing the uuids of both devices.\n\n#### When I reboot / upgrade / reset my device system, will device uuid change?\nPlease check the **persistence** table above.\n\n## Support development\n[![Donate](https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=fabio%2ecaccamo%40gmail%2ecom\u0026lc=IT\u0026item_name=Fabio%20Caccamo%20%2d%20Open%20Source%20Projects\u0026item_number=FCUUID\u0026currency_code=EUR\u0026bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted)\n\n## License\nReleased under [MIT License](LICENSE).\n","funding_links":["https://github.com/sponsors/fabiocaccamo","https://ko-fi.com/fabiocaccamo","https://liberapay.com/fabiocaccamo","https://www.buymeacoffee.com/fabiocaccamo","https://www.paypal.me/fabiocaccamo","https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=fabio%2ecaccamo%40gmail%2ecom\u0026lc=IT\u0026item_name=Fabio%20Caccamo%20%2d%20Open%20Source%20Projects\u0026item_number=FCUUID\u0026currency_code=EUR\u0026bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted"],"categories":["Objective-C  Stars 1000以内排名整理"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiocaccamo%2FFCUUID","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabiocaccamo%2FFCUUID","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiocaccamo%2FFCUUID/lists"}