@wangdu wrote:
各位大大下午好,小弟在實作這位大神給的demo code。
自己研究大約三天了,主要卡在以下問題:
第一個問題,在theos make package的時候出現ld: framework not found MobileInstallation錯誤:
按照書本上的指導得知,若要引用私用框架需要寫上MyProject_PRIVATE_FRAMEWORKS = MobileInstallation
但是在mack package的時候始終顯示not found。
我去過/opt/theos底下找的到~/opt/theos/include/PrivateFrameworks/MobileInstallation: CDStructures.h MobileInstallerDelegateProtocol-Protocol.h MIInstallerClient.h MobileInstallerProtocol-Protocol.h
我去過iphone 8.1.2手機上用openssh看過也有:
/System/Library/PrivateFrameworks/MobileInstallation.framework /System/Library/PrivateFrameworks/MobileInstallation.framework/Info.plist /System/Library/PrivateFrameworks/MobileInstallation.framework/_CodeSignature /System/Library/PrivateFrameworks/MobileInstallation.framework/_CodeSignature/CodeResources /private/var/mobile/Library/Logs/MobileInstallation /private/var/mobile/Library/Logs/MobileInstallation/mobile_installation.log.0 /private/var/mobile/Library/Logs/MobileInstallation/mobile_installation.log.1 /private/var/mobile/Library/MobileInstallation /private/var/mobile/Library/MobileInstallation/AppMigratorLastSystemVersion.plist /private/var/mobile/Library/MobileInstallation/DiskImagesInfo.plist /private/var/mobile/Library/MobileInstallation/LastBuildInfo.plist /private/var/mobile/Library/MobileInstallation/LastLaunchServicesMap.plist /private/var/mobile/Library/MobileInstallation/UninstalledApplications.plist
我也去過電腦上的xcode底下也找得到~/Library/Developer/Xcode/iOS DeviceSupport/8.1.2 (12B440)/Symbols/System/Library/PrivateFrameworks/MobileInstallation.framework
所以我可以斷定這個框架他是存在的,但書上第33頁也有提到該如何導入私用框架,因此想請問大大,哪個地方我做錯了?該怎麼修正錯誤?
第二個問題就是以下這段程式碼是我參考原文作者和網上其他資料的,執行上始終死在 if (mobileInstallationUninstallForLaunchServices)這邊,所以我判定是私用框架沒有成功導入,無法呼叫MobileInstallationUninstall這個方法,或者另一個可能是iOS8.1.2已經沒有這個方法?我在想第一個問題解決了,或許第二個問題也會有頭緒。因為這兩個問題是連貫的所以放在一起,如不符合發帖規則,此無視第二問題,專注第一問題。
typedef void (*MobileInstallationCallback)(CFDictionaryRef information); typedef int (* MobileInstallationUninstallForLaunchServices)(CFStringRef bundleIdentifier, CFDictionaryRef parameters, MobileInstallationCallback callback, void *unknown); - (void)unInstallTap:(id)sender { NSLog(@"uninstalling..."); void *lib = dlopen("/System/Library/PrivateFrameworks/MobileInstallation.framework/MobileInstallation", RTLD_LAZY); if (lib) { MobileInstallationUninstallForLaunchServices mobileInstallationUninstallForLaunchServices = (MobileInstallationUninstallForLaunchServices)dlsym(lib, "MobileInstallationUninstall"); if (mobileInstallationUninstallForLaunchServices) { CFStringRef identifier = CFStringCreateWithCString(kCFAllocatorDefault, [BundleID UTF8String], kCFStringEncodingUTF8); int ret = mobileInstallationUninstallForLaunchServices(identifier, NULL, NULL, NULL); CFRelease(identifier); // return ret; NSLog(@"iOSRE Uninstall: %d", ret); } else { NSLog(@"iOSRE mobileInstallationUninstallForLaunchServices nil"); } } else { NSLog(@"iOSRE lib nil"); } }
感謝大大們撥空解答!
Posts: 1
Participants: 1