服务器数据返回为空,[iOS功能]- iOS关于服务器返回数据为null---[NSNull length]

只要把.m文件拖进工程,啥也不需要做就可以了,想要详细研究的可以去gitHub详细看:

https://github.com/nicklockwood/NullSafe

//

// NullSafe.m

//

// Version 2.0

//

// Created by Nick Lockwood on 19/12/2012.

// Copyright 2012 Charcoal Design

//

// Distributed under the permissive zlib License

// Get the latest version from here:

//

// https://github.com/nicklockwood/NullSafe

//

// This software is provided 'as-is', without any express or implied

// warranty. In no event will the authors be held liable for any damages

// arising from the use of this software.

//

// Permission is granted to anyone to use this software for any purpose,

// including commercial applications, and to alter it and redistribute it

// freely, subject to the following restrictions:

//

// 1. The origin of this software must not be misrepresented; you must not

// claim that you wrote the original software. If you use this software

// in a product, an acknowledgment in the product documentation would be

// appreciated but is not required.

//

// 2. Altered source versions must be plainly marked as such, and must not be

// misrepresented as being the original software.

//

// 3. This notice may not be removed or altered from any source distribution.

//

#import

#import

#ifndef NULLSAFE_ENABLED

#define NULLSAFE_ENABLED 1

#endif

#pragma clang diagnostic ignored "-Wgnu-conditional-omitted-operand"

@implementation NSNull (NullSafe)

#if NULLSAFE_ENABLED

- (NSMethodSignature *)methodSignatureForSelector:(SEL)selector

{

//look up method signature

NSMethodSignature *signature = [super methodSignatureForSelector:selector];

if (!signature)

{

for (Class someClass in @[

[NSMutableArray class],

[NSMutableDictionary class],

[NSMutableString class],

[NSNumber class],

[NSDate class],

[NSData class]

])

{

@try

{

if ([someClass instancesRespondToSelector:selector])

{

signature = [someClass instanceMethodSignatureForSelector:selector];

break;

}

}

@catch (__unused NSException *unused) {}

}

}

return signature;

}

- (void)forwardInvocation:(NSInvocation *)invocation

{

invocation.target = nil;

[invocation invoke];

}

#endif

@end

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值