runtime直接獲取自己手機上已經安裝app的bundle id
runtime提供了一個方法直接可以獲取已經安裝app的bundle id。
直接上程式碼:
#include <objc/runtime.h>
Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace");
NSObject* workspace = [LSApplicationWorkspace_class performSelector:@selector(defaultWorkspace)];
NSLog(@"apps: %@", [workspace performSelector
:@selector(allApplications)]);
下面看一下我手機上安裝的App:
"<LSApplicationProxy: 0x157d27230> com.apple.AccountAuthenticationDialog",
"<LSApplicationProxy: 0x157d276e0> com.apple.AdSheetPhone",
"<LSApplicationProxy: 0x157d278c0> com.apple.Diagnostics",
"<LSApplicationProxy: 0x157d27aa0> com.apple.Maps",
"<LSApplicationProxy: 0x157d27c80> com.apple.PrintKit.Print-Center",
"<LSApplicationProxy: 0x157d27e60> com.apple.iBooks",
"<LSApplicationProxy: 0x157d28040> com.apple.mobilecal",
"<LSApplicationProxy: 0x157d28220> com.apple.MobileSMS",
"<LSApplicationProxy: 0x157d28400> com.apple.uikit.PrintStatus",
"<LSApplicationProxy: 0x157d285e0> com.apple.CloudKit.ShareBear",
"<LSApplicationProxy: 0x157d287c0> com.apple.Music",
"<LSApplicationProxy: 0x157d289a0> com.apple.podcasts",
"<LSApplicationProxy: 0x157d28b80> com.apple.compass",
"<LSApplicationProxy: 0x157d28d60> com.apple.fieldtest",
"<LSApplicationProxy: 0x157d28f40> com.apple.HealthPrivacyService",
"<LSApplicationProxy: 0x157d29120> com.apple.FacebookAccountMigrationDialog",
"<LSApplicationProxy: 0x157d29300> com.apple.iosdiagnostics",
"<LSApplicationProxy: 0x157d294e0> com.apple.AskPermissionUI",
"<LSApplicationProxy: 0x157d296c0> com.apple.AppStore",
"<LSApplicationProxy: 0x157d298a0> com.apple.Bridge",
"<LSApplicationProxy: 0x157d29a80> com.apple.mobilesafari",
"<LSApplicationProxy: 0x157d29c60> com.apple.weather",
"<LSApplicationProxy: 0x157d29f00> com.apple.gamecenter",
"<LSApplicationProxy: 0x157d2a0e0> com.apple.appleaccount.AACredentialRecoveryDialog",
"<LSApplicationProxy: 0x157d2a2c0> com.apple.PhotosViewService",
"<LSApplicationProxy: 0x157d2a4a0> com.apple.facetime",
"<LSApplicationProxy: 0x157d2a680> com.apple.VoiceMemos",
"<LSApplicationProxy: 0x157d2a9b0> com.apple.mobilenotes",
"<LSApplicationProxy: 0x157d2ab90> com.apple.Preferences",
"<LSApplicationProxy: 0x157d2ad70> com.apple.mobilephone",
"<LSApplicationProxy: 0x157d2af50> com.apple.share",
"<LSApplicationProxy: 0x157d2b130> com.apple.reminders",
"<LSApplicationProxy: 0x157d2b310> com.apple.mobiletimer",
"<LSApplicationProxy: 0x157d2b4f0> com.apple.TencentWeiboAccountMigrationDialog",
"<LSApplicationProxy: 0x157d2b6d0> com.apple.MobileAddressBook",
"<LSApplicationProxy: 0x157d2b8b0> com.apple.CoreAuthUI",
"<LSApplicationProxy: 0x157d2ba90> com.apple.datadetectors.DDActionsService",
"<LSApplicationProxy: 0x157d2bc70> com.apple.PassbookUIService",
"<LSApplicationProxy: 0x157d2be50> com.apple.TrustMe",
"<LSApplicationProxy: 0x157d2c030> com.apple.family",
"<LSApplicationProxy: 0x157d2c210> com.apple.webapp1",
"<LSApplicationProxy: 0x157d2c3f0> com.apple.appleseed.FeedbackAssistant",
"<LSApplicationProxy: 0x157d2c5d0> com.apple.InCallService",
"<LSApplicationProxy: 0x157d2c9d0> com.apple.WebSheet",
"<LSApplicationProxy: 0x157d2cbb0> com.apple.mobilemail",
"<LSApplicationProxy: 0x157d2cd90> com.apple.stocks",
"<LSApplicationProxy: 0x157d2cf70> com.apple.gamecenter.GameCenterUIService",
"<LSApplicationProxy: 0x157d2d150> com.apple.PreBoard",
"<LSApplicationProxy: 0x157d2d330> com.apple.SiriViewService",
"<LSApplicationProxy: 0x157d2d510> com.apple.DemoApp",
"<LSApplicationProxy: 0x157d2d6f0> com.apple.WebViewService",
"<LSApplicationProxy: 0x157d2d8d0> com.baofengyingyin.iphoneversion",
"<LSApplicationProxy: 0x157d2dab0> com.happyelements.1OSAnimal",
"<LSApplicationProxy: 0x157d2dc90> com.sogou.sogouinput",
"<LSApplicationProxy: 0x157d2de70> com.raventest.easemob",
"<LSApplicationProxy: 0x157d2e230> com.sqage.wohucanglong3d",
"<LSApplicationProxy: 0x157d2e410> com.ea.easportsufc.bv",
"<LSApplicationProxy: 0x157d2e5f0> com.meituan.imeituan",
"<LSApplicationProxy: 0x157d2e7d0> com.renren-inc.nuomi",
"<LSApplicationProxy: 0x157d2eb90> ctrip.com",
"<LSApplicationProxy: 0x157d2ed70> com.qunar.iphoneclient8",
"<LSApplicationProxy: 0x157d2ef50> com.raventech.RavenFlow",
"<LSApplicationProxy: 0x157d2f130> com.letv.iphone.client",
"<LSApplicationProxy: 0x157d2f310> com.alipay.iphoneclient",
"<LSApplicationProxy: 0x157d2f4f0> com.wemomo.momoappdemo1",
"<LSApplicationProxy: 0x157d2f6d0> com.raventest.gaode3d",
"<LSApplicationProxy: 0x157d2f8b0> com.raventest.LvesMessageShow",
"<LSApplicationProxy: 0x157d2c7b0> com.sina.weibo",
"<LSApplicationProxy: 0x157d2fe00> com.taobao.taobao4iphone",
"<LSApplicationProxy: 0x157d2ffe0> com.qiyi.iphone",
"<LSApplicationProxy: 0x157d301c0> com.hunantv.imgotv",
"<LSApplicationProxy: 0x157d303a0> com.tencent.QQMusic",
"<LSApplicationProxy: 0x157d30580> com.tencent.mqq",
"<LSApplicationProxy: 0x157d30760> com.xily.baijiajiangtandaquan",
"<LSApplicationProxy: 0x157d30940> cn.12306.rails12306",
"<LSApplicationProxy: 0x157d30b20> com.moji.MojiWeather",
"<LSApplicationProxy: 0x157d30d00> com.tencent.xin",
"<LSApplicationProxy: 0x157d30ee0> com.youku.YouKu",
"<LSApplicationProxy: 0x157d310c0> me.ele.ios.eleme",
"<LSApplicationProxy: 0x157d312a0> developer.apple.wwdc-Release",
"<LSApplicationProxy: 0x157d31480> com.apple.mobileme.fmip1",
"<LSApplicationProxy: 0x157d31660> com.tinyspeck.chatlyio",
"<LSApplicationProxy: 0x157d31840> com.baidu.map",
"<LSApplicationProxy: 0x157d31a20> cn.zaker.iphone",
"<LSApplicationProxy: 0x157d31c00> com.zhihu.ios",
"<LSApplicationProxy: 0x157d31de0> com.google.inbox",
"<LSApplicationProxy: 0x157d31fc0> com.google.chrome.ios",
"<LSApplicationProxy: 0x157d321a0> com.google.calendar",
"<LSApplicationProxy: 0x157d32380> com.xiaojukeji.didi",
"<LSApplicationProxy: 0x157d32560> com.apple.MobileReplayer",
"<LSApplicationProxy: 0x157d32740> com.facebook.Facebook",
"<LSApplicationProxy: 0x157d32920> com.ea.nfs13.bv.c",
"<LSApplicationProxy: 0x157d32b00> com.apple.Passbook",
"<LSApplicationProxy: 0x157d32ce0> com.apple.GameController",
"<LSApplicationProxy: 0x157d32ec0> com.apple.MailCompositionService",
"<LSApplicationProxy: 0x157d330a0> com.apple.calculator",
"<LSApplicationProxy: 0x157d33280> com.apple.SharedWebCredentialViewService",
"<LSApplicationProxy: 0x157d33460> com.apple.ios.StoreKitUIService",
"<LSApplicationProxy: 0x157d33640> com.apple.MobileStore",
"<LSApplicationProxy: 0x157d33820> com.apple.tips",
"<LSApplicationProxy: 0x157d33a00> com.apple.camera",
"<LSApplicationProxy: 0x157d33be0> com.apple.quicklook.quicklookd",
"<LSApplicationProxy: 0x157d33dc0> com.apple.webapp",
"<LSApplicationProxy: 0x157d33fa0> com.apple.CompassCalibrationViewService",
"<LSApplicationProxy: 0x157d34180> com.apple.iad.iAdOptOut",
"<LSApplicationProxy: 0x157d34360> com.apple.MusicUIService",
"<LSApplicationProxy: 0x157d34540> com.apple.WebContentFilter.remoteUI.WebContentAnalysisUI",
"<LSApplicationProxy: 0x157e114d0> com.apple.mobilesms.notification",
"<LSApplicationProxy: 0x157e127f0> com.apple.mobilesms.compose",
"<LSApplicationProxy: 0x157e129d0> com.apple.Fitness",
"<LSApplicationProxy: 0x157e12bb0> com.apple.videos",
"<LSApplicationProxy: 0x157e12d90> com.apple.social.SLGoogleAuth",
"<LSApplicationProxy: 0x157e12f70> com.apple.mobileslideshow",
"<LSApplicationProxy: 0x157e13150> com.apple.Health",
"<LSApplicationProxy: 0x157e13330> com.apple.purplebuddy",
"<LSApplicationProxy: 0x157e13510> com.zhangyue.zyiReader.iReader",
"<LSApplicationProxy: 0x157e136f0> com.360buy.jdmobile",
"<LSApplicationProxy: 0x157e138d0> com.apple.itunesu",
"<LSApplicationProxy: 0x157e13ab0> com.tencent.ioshlddz",
"<LSApplicationProxy: 0x157e13c90> com.ubisoft.assassin.pirates",
"<LSApplicationProxy: 0x157e13fc0> com.dianping.dpscope",
"<LSApplicationProxy: 0x157e141a0> com.tencent.live4iphone",
"<LSApplicationProxy: 0x157e14380> com.zlycare.zlycare-iphone",
"<LSApplicationProxy: 0x157e14560> com.sohu.iPhoneVideo",
"<LSApplicationProxy: 0x157e14740> com.raventest.ClockDemo",
"<LSApplicationProxy: 0x157e14920> com.jimubox.jimubox",
"<LSApplicationProxy: 0x157e14b00> com.raventest.gaode",
"<LSApplicationProxy: 0x157e14ce0> com.raventest.Asking",
"<LSApplicationProxy: 0x157e14ec0> com.raventest.mymapdemo"
)