草庐IT

unsafe-pointers

全部标签

objective-c - __unsafe_unretained 代表不会建立

我有来自.h文件的代码(片段):#import#import"ILView.h"/***Controlstheorientationofthepicker*/typedefenum{ILHuePickerViewOrientationHorizontal=0,ILHuePickerViewOrientationVertical=1}ILHuePickerViewOrientation;@classILHuePickerView;/***Huepickerdelegate*/@protocolILHuePickerViewDelegate/***Calledwhentheuserpick

objective-c - __unsafe_unretained 代表不会建立

我有来自.h文件的代码(片段):#import#import"ILView.h"/***Controlstheorientationofthepicker*/typedefenum{ILHuePickerViewOrientationHorizontal=0,ILHuePickerViewOrientationVertical=1}ILHuePickerViewOrientation;@classILHuePickerView;/***Huepickerdelegate*/@protocolILHuePickerViewDelegate/***Calledwhentheuserpick

ios - 圆弧 : "Pointer to non-const type ' id' with no explicit ownership"

我正在升级一个iOS4项目以将其与带有sdk5的ARC一起使用。所以我想使用自动重构方法将代码转换为使用ARC。不幸的是它不起作用。我收到很多错误..for(id*childinchildObjectArray){[childremoveParentGroupReferences];}这给了我以下错误输出:Pointertonon-consttype'id'withnoexplicitownership有什么帮助吗?我需要改变什么?感谢您的帮助.. 最佳答案 将id*更改为id。id已定义为对象指针。

ios - 圆弧 : "Pointer to non-const type ' id' with no explicit ownership"

我正在升级一个iOS4项目以将其与带有sdk5的ARC一起使用。所以我想使用自动重构方法将代码转换为使用ARC。不幸的是它不起作用。我收到很多错误..for(id*childinchildObjectArray){[childremoveParentGroupReferences];}这给了我以下错误输出:Pointertonon-consttype'id'withnoexplicitownership有什么帮助吗?我需要改变什么?感谢您的帮助.. 最佳答案 将id*更改为id。id已定义为对象指针。

ios - Swift 3 中的 UnsafePointer<UInt8> 初始值设定项

我有一个收据验证类,自Swift3发布以来已弃用。我解决了一些问题,但还有很多问题......这是我使用的GitHub源代码:https://gist.github.com/baileysh9/4386ea92b047d97c7285#file-parsing_productids-swift和https://gist.github.com/baileysh9/eddcba49d544635b3cf5第一个错误:varp=UnsafePointer(data.bytes)编译器抛出:无法使用类型为UnsafeRawPointer的参数列表调用类型为UnsafePointer(UInt8

ios - Swift 3 中的 UnsafePointer<UInt8> 初始值设定项

我有一个收据验证类,自Swift3发布以来已弃用。我解决了一些问题,但还有很多问题......这是我使用的GitHub源代码:https://gist.github.com/baileysh9/4386ea92b047d97c7285#file-parsing_productids-swift和https://gist.github.com/baileysh9/eddcba49d544635b3cf5第一个错误:varp=UnsafePointer(data.bytes)编译器抛出:无法使用类型为UnsafeRawPointer的参数列表调用类型为UnsafePointer(UInt8

objective-c - 自动引用计数 : Pointer to non-const type 'NSError *' with no explicit ownership

在更新我的一些代码以与iOS5SDK兼容时,我试图通过在Xcode中使用“转换为Objective-CARC”来重构我的代码,但收到错误消息。错误发生在我的.h文件中的实例变量上。NSError**_error;错误显示“指向没有明确所有权的非常量类型‘NSError*’的指针。”我该如何解决这个问题? 最佳答案 您可以使用TransitioningtoARCReleaseNotes中描述的生命周期限定符之一。对于NSError**你会使用__autoreleasing所以Nikolai提供的例子看起来像这样@interfaceFo

objective-c - 自动引用计数 : Pointer to non-const type 'NSError *' with no explicit ownership

在更新我的一些代码以与iOS5SDK兼容时,我试图通过在Xcode中使用“转换为Objective-CARC”来重构我的代码,但收到错误消息。错误发生在我的.h文件中的实例变量上。NSError**_error;错误显示“指向没有明确所有权的非常量类型‘NSError*’的指针。”我该如何解决这个问题? 最佳答案 您可以使用TransitioningtoARCReleaseNotes中描述的生命周期限定符之一。对于NSError**你会使用__autoreleasing所以Nikolai提供的例子看起来像这样@interfaceFo

objective-c - 无法在 Swift 中分配 UnsafeMutablePointer ObjCBool​​ 类型的值

我不熟悉ObjectiveC。我正在使用私有(private)框架,并且需要能够从我的Swift代码中更改其中一个属性。该属性在ObjectiveC中是这样声明的:@property(nonatomic,assign)BOOL*isSSNField;我正在尝试以这种方式快速更改属性的值:myClass.isSSNField=true我收到这个错误Cannotassignavalueoftype'Bool'toavalueoftype'UnsafeMutablePointer'我不确定从这里去哪里,或者为什么我会收到这个错误 最佳答案

objective-c - 无法在 Swift 中分配 UnsafeMutablePointer ObjCBool​​ 类型的值

我不熟悉ObjectiveC。我正在使用私有(private)框架,并且需要能够从我的Swift代码中更改其中一个属性。该属性在ObjectiveC中是这样声明的:@property(nonatomic,assign)BOOL*isSSNField;我正在尝试以这种方式快速更改属性的值:myClass.isSSNField=true我收到这个错误Cannotassignavalueoftype'Bool'toavalueoftype'UnsafeMutablePointer'我不确定从这里去哪里,或者为什么我会收到这个错误 最佳答案