Notes

news/2024/10/23 5:39:24/
★ Core Data
[[NSManagedObjectModel alloc] initWithContentsOfURL:momURL]  VS [[NSManagedObjectModel mergedModelFromBundles:nil] retain]
appDelegate.moc


★ appDelegate实例
CEIBSAppDelegate *appDelegate = (CEIBSAppDelegate *)[UIApplication sharedApplication].delegate;


★ COLOR设置
COLOR(180,18,21)
#define TITLESTYLE_COLOR  COLOR(180,18,21)
[UIColor clearColor]
[UIColor whiteColor]


★ Save
- (void)saveLoadAlumniInfoCount:(NSInteger)count {
    [[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithFormat:@"%d", count]
                                              forKey:LOAD_ALUMNI_INFO];
    [[NSUserDefaults standardUserDefaults] synchronize];
}


★ EXC_BAD_ACCESS
Case 1:
release了需要调用的对象,关键是定位。
CEIBS[2057:707] *** -[CFLocale release]: message sent to deallocated instance 0x399920


1,设置Product -> Edit Scheme -> Environment Variables

NSZombieEnabled YES

MallocStackLogging YES

NSAutoreleaseFreedObjectCheckEnabled

NSDebugEnabled



2,终端查看
malloc_history ${App_PID} ${Object_instance_addr}
malloc_history 2057:707 0x399920


查找0x399920 寻找相关代码


3,如果还不能找到,采用下面
#ifdef _FOR_DEBUG_
-(BOOL) respondsToSelector:(SEL)aSelector {
    printf("SELECTOR: %s\n", [NSStringFromSelector(aSelector) UTF8String]);
    return [super respondsToSelector:aSelector];
}
#endif


需要在每个object的.m或者.mm文件中加入上面代码,并且在
other c flags中加入-D _FOR_DEBUG_(记住只在Debug Configuration下加入此标记)。
这样当你程序崩溃时,Xcode的console上就会准确地记录了最后运行的object的方法。


★ 背景渐变
bg.png为背景渐变的图片。
view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bg.png"]];


★  静态库调用
USER_HEADER_SEARCH_PATHS = /Users/Adam/Documents/TestLibrary/TestLibrary/**


★  Tableview 没有值

numberOfRowsInSection 打印值,如果没有就是TableView没有初始化。


★  viewDidAppear调用
5.0以后会自动调用,4.3需要强制调用。


 Crash

Organizer -> Console <Error>

Mar 28 16:36:25 unknown iAlumni[1856] <Error>: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Cannot create an NSPersistentStoreCoordinator with a nil model'


 Login的独立

//- (void)openLogin

//{

//    

//    LoginViewController *mLoginController = [[[LoginViewController alloc] initWithMOC:managedObjectContext] autorelease];

//    homeNavVC.navigationBar.tintColor = TITLESTYLE_COLOR;

// [homeNavVC presentModalViewController:mLoginController animated:YES];

//    

//}


- (void)openLogin

{   

    LoginViewController *mLoginController = [[LoginViewController alloc] initWithMOC:managedObjectContext];

    UINavigationController *homeNav = [[UINavigationController alloc] initWithRootViewController:mLoginController];

    self.window.rootViewController = homeNav;

    homeNav.navigationBarHidden = YES;

    [self.window makeKeyAndVisible];

[self.window addSubview:homeNav.view];

    RELEASE_OBJ(mLoginController);

    RELEASE_OBJ(homeNav);

}


 void SendDelegateMessage(NSInvocation*): delegate (webView:decidePolicyForNavigationAction:request:frame:decisionListener:) failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode


 Apr  6 18:32:59 unknown iAlumni[80] <Error>: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Cannot create an NSPersistentStoreCoordinator with a nil model'


★  单个navigationController回到主界面

[self.navigationController popToRootViewControllerAnimated:YES];


★  真机调试

error: failed to launch '/Users/Adam/Library/Developer/Xcode/DerivedData/iAlumni-evlhawkehmiqrzacwjvtozfzhkcx/Build/Products/Debug-iphoneos/iAlumni.app/iAlumni' -- No such file or directory (/Users/Adam/Library/Developer/Xcode/DerivedData/iAlumni-evlhawkehmiqrzacwjvtozfzhkcx/Build/Products/Debug-iphoneos/iAlumni.app/iAlumni)


★  页面偏转

aVC -> bVC

下面两种方式,返回时aVC不会调用init.

aVC:[self.navigationController pushViewController:groupListVC animated:NO];

bVC:back button


aVC:[self presentModalViewController:helpVC animated:NO];

bVC:[self dismissModalViewControllerAnimated:YES];


★  等比例缩放

UIImageView *showImageView = [[[UIImageView alloc] initWithFrame:mImgFrame] autorelease];

showImageView.contentMode = UIViewContentModeScaleAspectFit;


★  安装新版本闪退

通过浏览器Safari一次更新ok,二次下载企业级应用,Crash log:

Apr 10 10:23:47 unknown SpringBoard[28] <Warning>: The 'iAlumni' bundle at /private/var/mobile/Applications/DCEF5386-2594-4118-A906-3525671E230B/iAlumni.app does not have an executable path. Please check the bundle's Info.plist file.

企业版本更新,在程序里面进行,而非通过;页面更新。


★  安装新版本闪退

-[CALayer retain]: message sent to deallocated instance 0xcfbda30

查找下面关键词,看看是否存在二次释放。

autorelease

release

RELEASE_OBJ


★  Xcode symbol not found

工程的索引文件损坏,删掉下面目录里面的文件

/Users/Adam/Library/Developer/Xcode/DerivedData


 拒绝父类颜色 

self.view.backgroundColor = [UIColor clearColor];


 UIButton丰富展现 

    _authorImageBackgroundView = [[UIView alloc] initWithFrame:CGRectMake(MARGIN * 2, 

                                                                          MARGIN * 2, 

                                                                          POSTLIST_PHOTO_WIDTH, 

                                                                          POSTLIST_PHOTO_HEIGHT)];

    _authorImageBackgroundView.backgroundColor = [UIColor clearColor];

    UIBezierPath *shadowPath = [UIBezierPath bezierPath];

    

    [shadowPath moveToPoint:CGPointMake(2, 2)];

    [shadowPath addLineToPoint:CGPointMake(POSTLIST_PHOTO_WIDTH + 1, 2)];

    [shadowPath addLineToPoint:CGPointMake(POSTLIST_PHOTO_WIDTH + 1, POSTLIST_PHOTO_HEIGHT + 1)];

    [shadowPath addLineToPoint:CGPointMake(2, POSTLIST_PHOTO_HEIGHT + 1)];

    [shadowPath addLineToPoint:CGPointMake(2, 2)];


    [shadowPath addArcWithCenter:CGPointMake(POSTLIST_PHOTO_WIDTH/2 + 2, POSTLIST_PHOTO_HEIGHT/2 + 2)

                          radius:PHOTO_SIDE_LENGTH/2 

                      startAngle:2 * M_PI 

                        endAngle:0 

                       clockwise:true];

    _authorImageBackgroundView.layer.shadowPath = shadowPath.CGPath;

    _authorImageBackgroundView.layer.shadowColor = [UIColor darkGrayColor].CGColor;

    _authorImageBackgroundView.layer.shadowOpacity = 0.9f;

    _authorImageBackgroundView.layer.shadowOffset = CGSizeMake(0, 0);

    _authorImageBackgroundView.layer.masksToBounds = NO;

    [self.contentView addSubview:_authorImageBackgroundView];


    _authorImageButton = [UIButton buttonWithType:UIButtonTypeCustom];

    _authorImageButton.frame = CGRectMake(0, 0, POSTLIST_PHOTO_WIDTH, POSTLIST_PHOTO_HEIGHT);

    _authorImageButton.layer.cornerRadius = 6.0f;

    _authorImageButton.layer.masksToBounds = YES;

    _authorImageButton.layer.borderWidth = 2.0f;

    _authorImageButton.layer.borderColor = [UIColor whiteColor].CGColor;

    _authorImageButton.showsTouchWhenHighlighted = YES;

    [_authorImageButton addTarget:self action:@selector(openProfile:) forControlEvents:UIControlEventTouchUpInside];

    [_authorImageBackgroundView addSubview:_authorImageButton];


 [self performSelector:@selector(doNext) withObject:nil afterDelay:0.01f]; 


☆TASK:
BaseUITableViewCell 整合 ECTextBoardCell



self.view.frame.size.width
LIST_WIDTH


★ /* Calculate screen size */
CGRect screenFrame = [[UIScreen mainScreen] applicationFrame];


★ 自定义UITableViewCell怎样在子控件触发时得到indexPath
NSIndexPath *indexPath = [_tableView indexPathForCell:(UITableViewCell *)[sender superview]];
UITableViewCell *cell = [_tableView cellForRowAtIndexPath:indexPath];
[as showFromRect:cell.bounds inView:cell animated:TRUE];


★ presentModalViewController
UserDetailViewController *userProfileVC = [[UserDetailViewController alloc] initWithPersonIdByNet:CLUB_USER_TY needAddContact:YES personId:userId personType:userType];
UINavigationController *navigationView = [[UINavigationController alloc] initWithRootViewController:userProfileVC];
navigationView.navigationBar.tintColor = TITLESTYLE_COLOR;
userProfileVC.MOC = _MOC;
userProfileVC.title = LocaleStringForKey(NSUserProfileTitle, nil);
[self presentModalViewController:navigationView animated:YES];
RELEASE_OBJ(userProfileVC);
RELEASE_OBJ(navigationView);


mNC.modalPresentationStyle = UIModalPresentationCurrentContext;
mNC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;


http://www.ppmy.cn/news/468536.html

相关文章

笔记...

抽象语言---编码 编码------二进制 二进制------电信号 处理电信号 OSI/RM 七层参考模型---开放式系统互联 参考模型 ----- ISO----国际标准化组织 第一台电子计算机---1946年2.14 1876年 贝尔获得电话专利 核心思想----分层 ​应用层---提供各种应用程序&#xff0c;将…

MySQL-notes

MySQL 学习笔记&#xff1a; 一、进入数据库&#xff1a;二、查看(database/table)三、使用数据库:四、创建(database/table):五、更改(表名/表中某栏目字段的数据类型)六、删除(数据库/表格):七、查询(表格内详细信息)&#xff1a;八、插入数据(table)&#xff1a;九、表格中删…

常用事件模型总结

事件模型一般有select、poll、 eventport 、dev/poll、epoll、kqueue这几种。以下对这几种事件模型逐个作原理讲解。 1.select模型  select通过select系统调用监视多个文件描述符集合&#xff0c;select调用返回后&#xff0c;集合中的文件描述符会被内核进行标志位的修改&a…

Kernel pwn 入门 (7)

本篇文章中&#xff0c;我们会练习回顾上一篇文章中学到的userfaultfd利用方式&#xff0c;同时学习一种新的利用方式&#xff1a;modprobe_path。使用的例题是&#xff1a;D^3CTF-2019 knote&#xff0c;需要两种利用配合使用。下面我们对本题进行分析。题目下载地址&#xff…

elementui el-image组件 点击预览图片

效果&#xff1a;点击单个图片&#xff0c;查看大图 <template><el-container class"platform-list-page"><el-main class"stationList"><data-tableref"DataTable":default-show-type"defaultShowType":default…

IPS、VA、TN屏构造和优缺点对比

转自https://display.ofweek.com/2018-05/ART-8321303-8500-30227810.html

送福利,价值1000的低蓝光护眼IPS显示屏,写代码神器!

快过年了&#xff0c; 为回馈各位老铁长期的关注与支持&#xff0c; 让大家能够更好的体验到编码的乐趣&#xff0c;提高技术水平&#xff0c; 直接送一个 低蓝光护眼IPS显示屏 &#xff01; 价值 1000 元&#xff0c; 简直美滋滋&#xff0c; 无论是自己用&#xff0c;还是当礼…

智慧屏鸿蒙哪个版本最好,高端技术下放毫不吝啬!华为智慧屏SE系列评测:鸿蒙OS让入门大屏也好用...

五、画质体验&#xff1a;在这块4K大屏上 超群的广色域覆盖是最大优势 对于大屏显示设备而言&#xff0c;更多人还是关注其画质体验。华为智慧屏SE系列搭载了一块LCD材质的屏幕&#xff0c;分辨率为4K&#xff0c;具备DCI-P3广色域。而且同价位段普通电视的色域覆盖率通常为DCI…