Object-C web前端常用方法和报错

方法:

1.NSLog打印

 %@  对象
 %d, %i  整数
 %u  无符整形
 %f  浮点/双字
 %x, %X  二进制整数
 %o  八进制整数
 %zu  size_t
 %p  指针
 %e  浮点/双字 (科学计算)
 %g  浮点/双字
 %s  C字符串
 %.*s  Pascal字符串
 %c  字符
 %C  unichar
 %lld  64位长整数(long long%llu  无符64位长整数
 %Lf  64位双字```

// 直接打印字符串
NSLog(@"this is a string");

// 打印OC对象
NSString *string = @"hello world";
NSLog(@"%@", string);

// 打印基本数据类型
NSLog(@"int : %d, float : %f", 2, 3.14);

 

 

 

 2.A.m 文件引用B.m文件中的方法

 A.m

#import "../../../../../质标院OA/Classes/AppDelegate.h"
[AppDelegate hello];

B.m

+ (void) hello
{
    NSLog(@"大家好");
}

B.h

@interface AppDelegate : CDVAppDelegate {}
+ (void) hello; //类方法,插在@interface 和 @end中间
@end

 

 

 报错:

1.

 

 工程中有同名文件

 

posted @ 2021-04-09 09:37  一路向北√  阅读(90)  评论(0编辑  收藏  举报

web应用开发&研究 -

业精于勤而荒于嬉。

工作,使我快乐。


Font Awesome | Respond.js | Bootstrap中文网