IOS學習筆記53 iOS 獲取手機系統屬性

2021-06-18 08:11:06 字數 461 閱讀 5131

// 當前手機的手機號碼

步驟如下:

1)匯入coretelephony這個private framework

2)在***.m中加入紅字部分:

#import "***.h"

extern nsstring *ctsettingcopymyphonenumber();

@implementation

+(nsstring *)mynumber

@end

其實很多地方都寫了 標識extern nsstring *ctsettingcopymyphonenumber(); 之後就可以直接引用ctsettingcopymyphonenumber() 

一開始發現總報錯說無此方法,非常納悶,結果是乙個字母大小寫的問題,汗顏.汗顏

ctsettingcopymyphonenumber();  這個方法 可以返回 手機號碼

原文**: 

IOS學習筆記

uiview beginanimations view flip context nil 設定動畫塊 uiview setanimationduration 1.25 動畫時間 uiview setanimationcurve uiviewanimationcurveeaseinout 動畫曲線 u...

ios學習筆記

actionsheet 標頭檔案裡加協議。ibaction buttonpressed id sender void actionsheet uiactionsheet actionsheet diddismisswithbuttonindex nsinteger buttonindex 從plis...

ios學習筆記

1.nsselectorfromstring nsstring string 從乙個字串構建乙個selector.2.字串 cocoa處理字串的類nsstring和它的子類nsmutablestring。id stringwithformat nsstring format,指可以接受以逗號分開的多...