2015-12-04 16 views
1

在IOS上工作一段時間後,我剛更新到Xcode 7.1 V7.1.1(7B1005)。使用Cocapods將解析更新到UIAlertCotroller

更新後我有問題使用Parse框架運行項目,所以我再次運行pod安裝來更新所有內容。 (下面豆莢輸出)

Updating local specs repositories 
Analyzing dependencies 
Downloading dependencies 
Using Bolts (1.2.2) 
Using Parse (1.8.5) 
Using ParseUI (1.1.6) 
Using PercentEncoder (1.0.0) 
Generating Pods project 
Integrating client project 
Sending stats 
Pod installation complete! There are 3 dependencies from the Podfile and 4 total 
pods installed. 

這工作得很好,現在項目構建並運行再次完美地有一個明顯的例外。

我現在得到有關UIAlertView在IOS9中棄用的警告(我知道這已被UIAlertCotroller取代)。這些警告指向ParseUI框架文件。

​​

以下所有罰款都會收到相同的警告。

PFUIAlertView.h 
PFLogInViewController.m 
PFQueryCollectionViewController.m 
PFQueryTableViewController.m 
PFUIAlertView.m 

發生這種情況是因爲Parse UI過期了嗎?或者我錯過了什麼或做錯了什麼?

我的代碼沒有任何錯誤或警告。

我看起來很高,看起來沒有其他人有這個問題。

請幫我卡住,不知道穿什麼看。

+0

現在已經更新到Xcode 7.2,仍然存在問題。 – joffd

回答

0

看來Parse-UI項目已過時。縱觀頭,它延伸UIAlertView

// PFUIAlertView.h 
#import <UIKit/UIKit.h> 

@interface PFUIAlertView : UIAlertView 

+ (void)showAlertViewWithTitle:(NSString *)title 
         error:(NSError *)error; 
+ (void)showAlertViewWithTitle:(NSString *)title 
         message:(NSString *)message; 
+ (void)showAlertViewWithTitle:(NSString *)title 
         message:(NSString *)message 
      cancelButtonTitle:(NSString *)cancelButtonTitle; 
@end 

// PFUIAlertView.m 
+ (void)showAlertViewWithTitle:(NSString *)title 
         message:(NSString *)message 
      cancelButtonTitle:(NSString *)cancelButtonTitle { 
    UIAlertView *alertView = [[self alloc] initWithTitle:title 
               message:message 
               delegate:nil 
             cancelButtonTitle:cancelButtonTitle 
             otherButtonTitles:nil]; 
    [alertView show]; 
} 

爲了什麼它的價值,有一個open issue,但對工作似乎停滯不前。也許把它放在那裏將有助於更新進行。

你可以找到完整的來源here

+0

那就是我的想法。謝謝。我是對的,如果我用UIAlertController替換ParseUI文件中的UIalertview代碼,就像我在自己的代碼中一樣,它應該修復問題,直到出現Parse更新爲止? – joffd

+0

@joffd我不這麼認爲。 'UIAlertController'是'UIViewController'的子類,所以需要像其他視圖控制器一樣處理。另外,設置按鈕是非常不同的。我的建議是避免一起使用PFUIAlertView(如果可能),並直接使用'UIAlertController'。說實話,[使用起來更容易](http://nshipster.com/uialertcontroller/)。其次,如果您開始編輯Parse文件,則在下一個「pod更新」或「pod安裝」時,這些編輯會丟失。 –

+0

@joffd你可以看看[方法調整](http://nshipster.com/method-swizzling/)並用你自己的替換PFUIAlertView的實現。儘管如此,我無法幫助。 –