HTML5   发布时间:2022-04-27  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – 缺少方法声明的上下文 – 应用内收据verificationController大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
应用程序运行正常,但在 Xcode 6上它的错误方法声明缺少上下文”在下面的方法
- (NSString *)encodeBase64:(const uint8_t *)input length:(NSInteger)length{
    static char table[] = "ABCDEFGHIJKLMNOPQRstuVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
    NSMutableData* data = [NSMutableData dataWithLength:((length + 2) / 3) * 4];
    uint8_t* output = (uint8_t*)data.mutableBytes;
    for (NSInteger i = 0; i < length; i += 3) {
        NSInteger value = 0;
        for (NSInteger j = i; j < (i + 3); j++) {
            value <<= 8;
            if (j < length) {
                value |= (0xFF & input[j]);
            }
        }
        NSInteger index = (i / 3) * 4;
        output[index + 0] =                    table[(value >> 18) & 0x3F];
        output[index + 1] =                    table[(value >> 12) & 0x3F];
        output[index + 2] = (i + 1) < length ? table[(value >> 6)  & 0x3F] : '=';
        output[index + 3] = (i + 2) < length ? table[(value >> 0)  & 0x3F] : '=';
    }
    return [[[NSString alloc] initWithData:data    encoding:NSASCIIStringEncoding] autorelease];
}

// Exact code above @end is : 

/*
- (NSString *)encodeBase64:(const uint8_t *)input length:(NSInteger)length
{ 
#warning replace this method.
return nil;
}


- (NSString *)decodeBase64:(NSString *)input length:(NSInteger *)length
{
#warning replace this method.
return nil;
}

#warning Implement this function.
char* base64_encode(@R_944_2942@ buf,size_t sizE)
{ return NULL; }

#warning Implement this function.
void * base64_decode(const char* s,size_t * data_len)
{ return NULL; }

*/
@end

解决方法

我也遇到了这个问题.似乎是使用Xcode6,他们不希望您将C/C++代码放在Objective-C上下文中.

我将VerificationController中的C/C++代码移到@implementation / @end块之前,然后编译好了.

大佬总结

以上是大佬教程为你收集整理的ios – 缺少方法声明的上下文 – 应用内收据verificationController全部内容,希望文章能够帮你解决ios – 缺少方法声明的上下文 – 应用内收据verificationController所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。