# Issue with NativeModule

**URL:** <https://forums.fusetools.com/t/issue-with-nativemodule/2968>\
**Category:** How-to Discussions\
**Created:** [June 4, 2016, 12:20pm UTC](https://forums.fusetools.com/t/issue-with-nativemodule/2968 "2016-06-04T12:20:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Donald](https://avatars.discourse-cdn.com/v4/letter/d/ac8455/32.png) [@Donald](https://forums.fusetools.com/u/Donald)\
**Post date:** [June 4, 2016, 12:20pm UTC](https://forums.fusetools.com/t/issue-with-nativemodule/2968/1 "2016-06-04T12:20:56Z")

</div>

this is my first attempt with implementation native module for get device id

```auto
using Uno;
using Uno.Collections;
using Fuse.Scripting;
using Fuse;
using Uno.Compiler.ExportTargetInterop;

public class UIDevice : NativeModule
{
    public UIDevice()
    { AddMember( new NativeFunction("getDeviceID", (NativeCallback)GetDeviceID) );
    }

    object GetDeviceID(Context c, object[] args)
    {
        return getDeviceID();
    }

    [Foreign(Language.ObjC)]
    extern(iOS) public string getDeviceID () 
    @{
        NSString* Identifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
        return Identifier;
    @}

    [Foreign(Language.Java)]
    static extern(Android) string getDeviceID()
    @{
        TelephonyManager manager=(TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
        String uuid = manager.getDeviceId();
        return uuid;
    @}

    static extern(!(iOS||Android)) string getDeviceID()
    {
        return "0123456789";
    }
}

```

… but after compilation for iOS throws me this error

 ![file](https://s3.us-east-2.amazonaws.com/fuse-legacy-forum-assets/eeYSp0b6gNAp-legacy-files-lJBfBbpjw6Kx73eH-X38OwHmEy4tb_8W_4OawJODl.png)

plz. has anybody some idea, how can i fix it ?

---

<div class="post-metadata">

**Author:** ![Anders\_Lassen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_lassen/32/522_2.png) [@Anders\_Lassen](https://forums.fusetools.com/u/Anders_Lassen)\
**Post date:** [June 4, 2016, 12:55pm UTC](https://forums.fusetools.com/t/issue-with-nativemodule/2968/2 "2016-06-04T12:55:00Z")

</div>

Hi!

It seems that the problem is that you named your calss the same as an existing Objective-C class. Try renaming your class to something else.

---

<div class="post-metadata">

**Author:** ![Donald](https://avatars.discourse-cdn.com/v4/letter/d/ac8455/32.png) [@Donald](https://forums.fusetools.com/u/Donald)\
**Post date:** [June 4, 2016, 1:33pm UTC](https://forums.fusetools.com/t/issue-with-nativemodule/2968/3 "2016-06-04T13:33:22Z")

</div>

such inattention … Very thanks @Anders Lassen …

I put here correct implementation of NativeModul with UIDevice detection for another people 🙂

```auto
using Uno;
using Uno.Collections;
using Fuse;
using Fuse.Scripting;

using Uno.Compiler.ExportTargetInterop;

public class UserUIDevice : NativeModule
{
    public UserUIDevice()
    { AddMember( new NativeFunction("getDeviceID", (NativeCallback)GetDeviceID) );
    }

    object GetDeviceID(Context c, object[] args)
    {
        return GetDeviceID();
    }

    [Foreign(Language.ObjC)]
    static extern(iOS) string GetDeviceID () 
    @{
        NSString* Identifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
        return Identifier;
    @}

    [Foreign(Language.Java)]
    static extern(Android) string GetDeviceID()
    @{
        TelephonyManager manager=(TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
        String uuid = manager.getDeviceId();
        return uuid;
    @}

    static extern(!(iOS||Android)) string GetDeviceID()
    {
        return "0123456789";
    }
}

```
