iOS - UUID代抛出一个奇怪的异常 [英] iOS - UUID generation throwing a strange exception

查看:201
本文介绍了iOS - UUID代抛出一个奇怪的异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 https://github.com/gekitz / UIDevice-with-UniqueIdentifier-for-iOS-5 生成全局标识符。当我在git中尝试该示例时,它工作正常并正确显示标识符。但是,当我尝试将文件合并到一个新项目时,它不起作用!

I am trying to use https://github.com/gekitz/UIDevice-with-UniqueIdentifier-for-iOS-5 to generate a global identifier. When I try the sample in git it works fine and displays an identifier correctly. But when I try to incorporate the files into a new project it does not work!

我已经包含 -

#import "UIDevice+IdentifierAddition.h"

in my SampleAppDelegate.m,复制粘贴项目中的所有文件,并使用

in my SampleAppDelegate.m, copy pasted all files in the project, and am using

NSString *di = [[UIDevice currentDevice] uniqueGlobalDeviceIdentifier];

。我在uniqueGlobalDeviceIdentifier方法的第一行放了一个断点,但它永远不会到达!我错过了什么吗?

in the init method. I put a breakpoint on the first line of uniqueGlobalDeviceIdentifier method, but it is never reached! Am I missing something?

编辑:

异常 -

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIDevice uniqueGlobalDeviceIdentifier]: unrecognized selector sent to instance 0x68170c0'


推荐答案

看起来像 UIDevice + IdentifierAddition.m 未编译。要检查/添加它:

It looks like UIDevice+IdentifierAddition.m is not being compiled. To check / add it:


  1. 点击Xcode左侧导航器中的项目。

  2. 选择应用目标。

  3. 选择'Build Phases'选项卡。

  4. 打开'Compile Sources'。

  5. 检查 UIDevice + IdentifierAddition.m 是否存在。如果没有,则单击+,选择它并单击添加。

  1. Click on the project in the navigator on the left in Xcode.
  2. Select the app target.
  3. Select the 'Build Phases' tab.
  4. Open up 'Compile Sources'.
  5. Check that UIDevice+IdentifierAddition.m is in there. If not, then click the '+', select it and click add.

该异常指向此作为修复,因为它说的是 UIDevice 上没有方法,名为 uniqueGlobalDeviceIdentifier ,由类别添加。

The exception points to this as the fix because it's saying that there is no method on UIDevice called uniqueGlobalDeviceIdentifier, which is added by the category.

这篇关于iOS - UUID代抛出一个奇怪的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆