iOS The problems that i encountered

1、目標適配與目標顯示問題xcode

(1)場景一ruby

Ambient Scout Appbash

Background:app

在自定義View(xib)中,繪製曲線。在Controller中添加自定義View。curl

Phenomenon:ide

在界面中顯示的SubView,與AutoLayout的Frame不一致。函數

Method:佈局

在ViewDidLayout中,從新設置SubView的Frame(當前處理方式)。ui

更具體緣由 - TBDthis

(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

 

2、UIImage內存管理問題(釋放問題)

Ambient Smart App

Background:

在視頻中截圖,時間內不斷持續截圖

Phenomennon:

內存不斷升高,直至Crash Due to Memery 

Method:

TBD

 

3、獲取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

 

4、cellForItemAtIndexPath(For CollectionView Using)

Background:

利用cellForItemAtIndexPath遍歷獲取每一個Cell的值,並賦值新變量

Phenomennon:

cellForItemAtIndexPath值調用了3次(實際有>3個Cell)

Method(Reason):

TBD

 

5、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:

調整(調試)、修正數據

 

 6、獲取觸發控件的Frame

(1)獲取當前觸發控件的Frame

(2)依據此Frame,顯示SubView的Origin

 

7、issues

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

數據線斷開,從新插上就行了 

 

8、build問題

(1)Background

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

(2)Phenomenon

App installation failed

(3)Method

刪掉在App Store中已下載的App.

 

9、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

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

10、關於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

 

問題2、更新失敗(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);

相關文章
相關標籤/搜索