iOS The problems that i encountered

一、目标适配与目标显示问题

(1)场景一

Ambient Scout App

Background:

在自定义View(xib)中,绘制曲线。在Controller中添加自定义View。

Phenomenon:

在界面中显示的SubView,与AutoLayout的Frame不一致。

Method:

在ViewDidLayout中,重新设置SubView的Frame(当前处理方式)。

更具体原因 - TBD

(2)场景二

Cutom Camera For Faces Reconization

Background:

在Controller中添加SubView,并AutouLayout其布局。

Phenomenon:

在界面显示的SubView,与AutoLayout的Frame不一致。

Method:

在ViewDidLayout中,重新设置SubView的Frame(当前处理方式)。

更具体原因 - TBD

Attached Snapshot:

---> <--- 在截图过程中,发现AutoLayout与界面显示莫名一致了(基于去掉ViewDidLayout方法),反复试之如上。Specified Reason - TBD

 

二、UIImage内存管理问题(释放问题)

Ambient Smart App

Background:

在视频中截图,时间内不断持续截图

Phenomennon:

内存不断升高,直至Crash Due to Memery 

Method:

TBD

 

三、获取Wi-Fi的SSID

#import<SystemConfiguration/CaptiveNetwork.h> // NSString *ssid = infossid[@"SSID"];+ (id)FetchSSIDInfo { id infossid = nil; NSArray *ifs = CFBridgingRelease(CNCopySupportedInterfaces());for(NSString *ifnam in ifs) { infossid = CFBridgingRelease(CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam));if(infossid && [infossid count]) {returninfossid; } }returninfossid; }

在iOS12.0.1 6SP无效

解决:重要
要在iOS 12及更高版本中使用此功能,请在Xcode中为您的应用启用Access WiFi信息功能。 启用此功能后,Xcode会自动将Access WiFi信息权利添加到您的权利文件和应用程序ID中。
苹果官方文档:CNCopyCurrentNetworkInfo

 

四、cellForItemAtIndexPath(For CollectionView Using)

Background:

利用cellForItemAtIndexPath遍历获取每个Cell的值,并赋值新变量

Phenomennon:

cellForItemAtIndexPath值调用了3次(实际有>3个Cell)

Method(Reason):

TBD

 

五、deleteRowsAtIndexPaths:withRowAnimation:的使用

Eg:[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationLeft];

Background:

左滑操作,实现删除当前Cell

Phenomenon:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0.  The number of rows contained in an existing section after the update (5) must be equal to the number of rows contained in that section before the update (1), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).

Method(Reason):

(1)Reason:

数据处理有无,在调用deleteRowsAtIndexPaths:withRowAnimation:同时,更新numberOfRow方法等出错

(2)Method:

调整(调试)、修正数据

 

 六、获取触发控件的Frame

(1)获取当前触发控件的Frame

(2)依据此Frame,显示SubView的Origin

 

七、issues

An error was encountered while attempting to communicate with this device.

数据线断开,重新插上就好了 

 

八、build问题

(1)Background

App Store已下载App,Xcode中 build程式

(2)Phenomenon

App installation failed

(3)Method

删掉在App Store中已下载的App.

 

九、The problem that it uploads App to App Store

1>

(1)Background

App在打包(Archive)后,上传时

(2)Phenomenon

Uploaded with warnings

 

(3)Method

不影响上传,具体原因&处理措施 - TBD

2>

(1)Background

App is rejected by apple reviewer due to changing the version supported(only support device),The formmer support universal device.

(2)Phenomenon

(3)Method

reset the support the devices(universal device)

More Reasonable Method: TBD

 

**************************************************************

Date:2018.12.27

Author:Wind

Title:Block

**************************************************************

十、关于Block内容(传递内容)的限制的思考

(1)Background

Controller传递Block给Subview

(2)Phenomenon

Crash:Error Reason: Controller中的Block地址和Subview中的Block地址不一致,找不到Subview中的Block地址,而Crash

(3)Description

Controller中的Blcok,含有方法操作(CustomMethod&NetRuestMethod)

(4)Method - TBD

 

**************************************************************

Date:2019.01.12

Author:Wind

Title:Build

**************************************************************

(1)Background

occur when buliding

(2)Phenomenon

An error was encountered while attempting to communicate with this device.(service is invalid.)

Please try rebooting and reconnecting the device.

(3)Method

replugin the devcie after disconnected linking.

 

**************************************************************

Date:   2019.01.12

Author: Wind

Title:    Crash

**************************************************************

(1)Background

NSProxy的使用,timer的target设置为NSProxy的对象。=>定时器的释放

NSProxy *timerProxy = [[TimerProxy alloc] initWithTarget:self];

NSTimer *singleDeviceTimer = [NSTimer scheduledTimerWithTimeInterval:5 target:timerProxy selector:@selector(refreshSingleDeviceData) userInfo:nil repeats:YES];

[singleDeviceTimer];

(2)Phenomenon

proxyTime unselector to refreshSingleDeviceData...

(3)Method - TBD

 

附录:

#import <Foundation/Foundation.h>

@interface TimerProxy : NSProxy

-(instancetype)initWithTarget:(id)target;

@end

#import "TimerProxy.h"

@interface TimerProxy()

@property (nonatomic,weak) id target;

@end

@implementation TimerProxy

-(instancetype)initWithTarget:(id)target {

    self.target = target;

    return self;

}

 //这个函数让重载方有机会抛出一个函数的签名,再由后面的frowardInvocation:去执行

-(NSMethodSignature *)methodSignatureForSelector:(SEL)sel {    

    return [self.target methodSignatureForSelector:sel];

}

//将消息转发给其他对象,这里转发给控制器

-(void)forwardInvocation:(NSInvocation *)invocation {

    SEL sel = [invocation selector];

    if ([self.target respondsToSelector:sel]) {

        [invocation invokeWithTarget:self.target];

    }

}

@end

 

**************************************************************

Date:   2019.04.04

Author: Wind

Title:    Cocoa Pods安装- 

**************************************************************

bogon:~ wind$ sudo gem install cocoapods

Password:

问题一:安装失败(OpenSSL相关)

ERROR:  While executing gem ... (Gem::Exception)

    Unable to require openssl, install OpenSSL and rebuild Ruby (preferred) or use non-HTTPS sources

  折腾了2Month,终于解决。

操作:

1>更新了系统

2>重新安装RVM $ curl -L get.rvm.io | bash -s stable

3>列出出可用的ruby版本$ rvm list known

4>更新最新版ruby,我看到能用的最新版为2.4.1 $  rvm install 2.5.1

5>添加Ruby源$ gem sources -a http://gems.ruby-china.com/

6>重新下载pod $ sudo gem install cocoapods 

Refer:https://my.oschina.net/iceTear/blog/2979962

 

问题二、更新失败(Pod Update)

(1)Background

安装Charts,需要更新pod操作

(2)Phenomenon

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

(3)方式

sudo xcode-select --switch /Applications/Xcode.app

(4)Reason

原因是Xcode重命名后,xcodebuild找不到原来的Xcode了。

https://blog.csdn.net/fallenink/article/details/52787939

 

问题三:在安装ChartsRealm时,命令行会有安装Realm的内容,此时,长时间安装不成功

(1)Background

安装ChartsRealm

(2)Phenomenon

命令行会有安装Realm的内容,此时,长时间安装不成功

(3)Method - TBD

https://www.jianshu.com/p/2d305fda8e4d

 

问题四:Charts安装

(1)Background

安装Charts

(2)Phenomenon

- `Charts` does not specify a Swift version and none of the targets (`Demo`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.

(3)Method - TBD

 

**************************************************************

Date:   2019.04.17

Author: Wind

Title:    App Crash

**************************************************************

 

**************************************************************

弹窗问题

2018.05.14

**************************************************************

UIAlertController中,actionSheet类型的Alert使用(iPhone正常,iPad中报错)

Phenomenon:

Your application has presented a UIAlertController of style UIAlertControllerStyleActionSheet. The modalPresentationStyle of a UIAlertController with this style is UIModalPresentationPopover. You must provide location information for this popover through the alert controller’s popoverPresentationController. You must provide either a sourceView and sourceRect or a barButtonItem. If this information is not known when you present the alert controller, you may provide it in the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation.

 Reason:

在页面中设置了actionSheet类型的Alert,在iPhone环境可以正常显示,如下。但是在iPad环境下会报以上错误。原因是iPad上的actionSheet样式会直接转换为popover样式,如果不提前设置好popover样式的话,iPad就不知道如何显示,进而报错 

 Solution:

alertController.popoverPresentationController.sourceView = self.view; 

alertController.popoverPresentationController.sourceRect = CGRectMake(0,0,1.0,1.0);

 

posted @ 2018-10-31 18:39  Wind678  阅读(406)  评论(0编辑  收藏  举报