小编Jos*_*ell的帖子

struct.unpack导致TypeError:'int'不支持缓冲区接口

我在Python 3.4中使用struct模块,如下所示:

length = struct.unpack('>B', data[34])[0]
Run Code Online (Sandbox Code Playgroud)

data 看起来像这样:

b'\x03\x01\x0e}GZ\xa8\x8e!\x1c\x7ft\xe8\xf9G\xbf\xb1\xdf\xbek\x8d\xb3\x05e~]N\x97\xad\xcaz\x03tP\x00\x00\x1eV\x00\xc0\n\xc0\t\xc0\x13\xc0\x14\xc0\x07\xc0\x11\x003\x002\x009\x00/\x005\x00\n\x00\x05\x00\x04\x01\x00\x00f\x00\x00\x00\x1b\x00\x19\x00\x00\x16parteek.khalsabani.com\xff\x01\x00\x01\x00\x00\n\x00\x08\x00\x06\x00\x17\x00\x18\x00\x19\x00\x0b\x00\x02\x01\x00\x00#\x00\x003t\x00\x00\x00\x10\x00\x1b\x00\x19\x08spdy/3.1\x06spdy/3\x08http/1.1\x00\x05\x00\x05\x01\x00\x00\x00\x00'
Run Code Online (Sandbox Code Playgroud)

我正进入(状态

TypeError:'int'不支持缓冲区接口.

我是使用struct的新手.怎么了?

python struct python-3.x

4
推荐指数
1
解决办法
4249
查看次数

提交时Apple Watch图标问题

我正在尝试将一个iOS应用程序提交到App Store(一个支持新Apple Watch的应用程序),并且我遇到了所需图标文件,它们的名称和大小的主要问题.我已经阅读了文档(https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/WatchHumanInterfaceGuidelines/IconandImageSizes.html#//apple_ref/doc/uid/TP40014992-CH16-SW1),它说创建图标@ 2x的尺寸48,55,80,88,172和196.这是什么意思,Icon-48x48@2x.png(96px x 96px)或Icon-24x24@2x.png(48px x 48px) .

当我提交我的二进制文件时,它一直给我错误...错误ITMS 90394缺少图标...错误ITMS 90392无效图标

有些人请详细说明我需要包含哪些图标名称和尺寸?!?

我已经猜到并检查了几个小时...... Icon-48x48@2x.png(88px x 88px)并不好...... Icon-24x24@2x.png(44px x 44px)并不好!

另外,我是否将图标文件添加到WatchKit App Extension或WatchKit应用程序?

ios apple-watch watchkit

4
推荐指数
1
解决办法
2663
查看次数

使用UserDefaults保存图像数组

我有一个应用程序,用户拍照,一旦拍照,它应保存到UserDefaults.我一直收到这个错误:

"cannot invoke 'setObject' with an argument list of type '(UIImage. type, forKey:[UIImage])'"
Run Code Online (Sandbox Code Playgroud)

我在这里搜索了文档和帖子,但没有任何帮助.这是我的代码.

let defaults = NSUserDefaults.standardUserDefaults()

func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]) {

    picker.dismissViewControllerAnimated(true, completion: nil)

    switch currentClothesSelection!{

        case "1":
            shirts.append(info[UIImagePickerControllerOriginalImage] as! UIImage)

            //this is where the error occurs
            defaults.setObject(UIImage.self, forKey: array1)

        case "2" :
            pants.append(info[UIImagePickerControllerOriginalImage] as! UIImage)
        case "3" :
            shorts.append(info[UIImagePickerControllerOriginalImage] as! UIImage)
        case "4" :
            jackets.append(info[UIImagePickerControllerOriginalImage] as! UIImage)
        case "5" :
            shoes.append(info[UIImagePickerControllerOriginalImage] as! UIImage)

        default:
         break
    }
Run Code Online (Sandbox Code Playgroud)

cocoa-touch nsuserdefaults ios swift

4
推荐指数
1
解决办法
1889
查看次数

应用扩展程序名称不能与应用程序名称相同?

我有一个名为"name"的应用程序,我在Xcode中转到File> New Target,并选择了一个共享扩展,但当我尝试给它一个与app(容器)名称相同的名称时,我收到一个错误信息 :

项目"name"已包含名为"name"的目标.请选择其他名称.

但显然我希望您的应用名称和扩展名称相同,(像其他应用扩展程序,如Pocket).

我选择的扩展名是实际出现在扩展菜单上的名称,而不是容器应用名称.

我怎么会给他们相同的名字?

xcode ios

4
推荐指数
1
解决办法
1526
查看次数

在OS X v10.11中不推荐使用NSTextView的insertText方法.什么是替代品?

我在AppKit API Reference中看到该insertText方法在OS X v10.11中已弃用.我应该用什么作为替代品呢?

macos cocoa nstextview appkit

4
推荐指数
1
解决办法
2000
查看次数

Paypal未来的付款和订单之间有什么不同

我有一个IOS应用程序,允许客户购买物品,这些物品可在大约一周或2小时内使用.我正在尝试了解哪种付款方式符合我的需要.

我阅读了Paypal移动sdk和Paypal rest api的文档,我不明白之间有什么不同:

1.Future Payment - https://developer.paypal.com/docs/integration/mobile/make-future-payment/

2.Place and Order - https://developer.paypal.com/docs/integration/direct/create-process-order/

是否支付了资金?

paypal

4
推荐指数
1
解决办法
1534
查看次数

Cocoa应用程序中有哪些不同类型的内存地址?

每当我在我的Cocoa应用程序中查看内存地址时,我会注意到(通常)3个主要类别的地址

  • 0x00006xxxxxxx
  • 0x00007fffxxxx
  • 0x0000001xxxxx

我知道什么是什么 - 就像我注意到0x00006xxxxxxx地址似乎是我应用程序对象的指针?

并且0x0000001xxxxx似乎是内存中实际对象的地址?

但我真的不确定任何事情,我无法形成一个好的谷歌查询给我一个答案.

有没有人有资源,或者知道如何识别Cocoa应用程序中的地址类别?

cocoa objective-c memory-address

4
推荐指数
1
解决办法
73
查看次数

新的iOS9/OSX10.11 NSNumberFormatterStyle枚举值是什么意思?

iOS和OS X NSNumberFormatterStyle枚举使用新的iOS 9和OS X 10.11 SDK获得了4个新值!它们听起来很酷且很有用,但Apple的文档,甚至谷歌都没有什么可说的!

传递给公式时这些新值的作用是什么,它们与旧值有什么不同?


在iOS 9.0或OS X 10.11中>框架>基础> NSNumberFormatter.h第46-57行:

typedef NS_ENUM(NSUInteger, NSNumberFormatterStyle) {
    NSNumberFormatterNoStyle = kCFNumberFormatterNoStyle,
    NSNumberFormatterDecimalStyle = kCFNumberFormatterDecimalStyle,
    NSNumberFormatterCurrencyStyle = kCFNumberFormatterCurrencyStyle,
    NSNumberFormatterPercentStyle = kCFNumberFormatterPercentStyle,
    NSNumberFormatterScientificStyle = kCFNumberFormatterScientificStyle,
    NSNumberFormatterSpellOutStyle = kCFNumberFormatterSpellOutStyle,
    NSNumberFormatterOrdinalStyle NS_ENUM_AVAILABLE(10_11, 9_0) = kCFNumberFormatterOrdinalStyle,
    NSNumberFormatterCurrencyISOCodeStyle NS_ENUM_AVAILABLE(10_11, 9_0) = kCFNumberFormatterCurrencyISOCodeStyle,
    NSNumberFormatterCurrencyPluralStyle NS_ENUM_AVAILABLE(10_11, 9_0) = kCFNumberFormatterCurrencyPluralStyle,
    NSNumberFormatterCurrencyAccountingStyle NS_ENUM_AVAILABLE(10_11, 9_0) = kCFNumberFormatterCurrencyAccountingStyle,
};
Run Code Online (Sandbox Code Playgroud)

cocoa enums cocoa-touch foundation nsnumberformatter

4
推荐指数
1
解决办法
598
查看次数

新Xcode 7.1中有100多个警告?

我已经更新了最新版本的Xcode 7.1.我收到了大约100多个编译器警告.

例:

warning: /Users/2141/Library/Developer/Xcode/DerivedData/ModuleCache/2GQZ88U0K6E0E/ObjectiveC-2CD0WTQVXITO7.pcm: No object file for requested architecture
while processing /Users/mohideen-2141/Library/Developer/Xcode/DerivedData/NoteBook-bldlsbruffeylydfevskmbnsmjfm/Build/Products/Debug-iphoneos/libAFNetworking.a(AFURLRequestSerialization.o):
Run Code Online (Sandbox Code Playgroud)

xcode compiler-warnings ios

4
推荐指数
1
解决办法
449
查看次数

64位NS_OPTIONS位掩码

上下文

我正在使用NS_OPTIONS宏来创建一个位掩码.我已经为它分配了一种类型,NSInteger因为我正在构建一个64位平台,这应该给我总共63个"槽"(64位少一位用于签名).

这是枚举:

typedef NS_OPTIONS(NSInteger, LPSVGOPlugin) {
    LPSVGOPluginNone                            = 0,
    LPSVGOPluginCleanupAttrs                    = 1 << 0,
    LPSVGOPluginRemoveDoctype                   = 1 << 1,
    LPSVGOPluginRemoveXMLProcInst               = 1 << 2,
    LPSVGOPluginRemoveComments                  = 1 << 3,
    LPSVGOPluginRemoveMetadata                  = 1 << 4,
    LPSVGOPluginRemoveTitle                     = 1 << 5,
    LPSVGOPluginRemoveDesc                      = 1 << 6,
    LPSVGOPluginRemoveUselessDefs               = 1 << 7,
    LPSVGOPluginRemoveEditorsNSData             = 1 << 8,
    LPSVGOPluginRemoveEmptyAttrs                = 1 << 9,
    LPSVGOPluginRemoveHiddenElems               = 1 << 10,
    LPSVGOPluginRemoveEmptyText                 = 1 << 11,
    LPSVGOPluginRemoveEmptyContainers           = 1 << 12,
    LPSVGOPluginRemoveViewBox …
Run Code Online (Sandbox Code Playgroud)

c cocoa enums objective-c bitmask

4
推荐指数
1
解决办法
743
查看次数