如何启动无URL方案并没有触及在非越狱的iDevice的图标应用程序?(How to launch

2019-10-17 13:06发布

我想建立一个应用程序来查看,而不URL方案的具体应用我听说过一个框架调用SpringBoardServices但总有一个链接错误

据我用这个代码与SpringBoardServices.h文件

SpringBoardServices.h:

#define SPRINGBOARDSERVICES_H

#if __OBJC__


#if __cplusplus
extern "C" {
#endif
#include <CoreFoundation/CoreFoundation.h>
#include <Availability.h>

    mach_port_t SBSSpringBoardServerPort();

#pragma mark -
#pragma mark Application launching
    /// Launch an application given the display ID.
    /// Equivalent to -[UIApplication launchApplicationWithIdentifier:suspended:].
    /// @return 0 on success, nonzero on failure. Feed the result to SBSApplicationLaunchingErrorString() to get the error string.
    int SBSLaunchApplicationWithIdentifier(CFStringRef displayIdentifier, Boolean suspended) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_3_0);

    /// Launch an application for debugging.
    /// The parameters are not known yet...
    int SBSLaunchApplicationForDebugging(void* unknown, ...) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_3_0);

    /// Get the error string from error code returned by SBSLaunchApplicationWithIdentifier().
    CFStringRef SBSApplicationLaunchingErrorString(int error);

#pragma mark -
#pragma mark Watchdog assertion

    typedef struct __SBSWatchdogAssertion* SBSWatchdogAssertionRef;

    CFTypeID SBSWatchdogAssertionGetTypeID();
    void SBSWatchdogAssertionCancel(SBSWatchdogAssertionRef assertion);
    SBSWatchdogAssertionRef SBSWatchdogAssertionCreateForPID(CFAllocatorRef allocator, pid_t pid);
    int SBSWatchdogAssertionRenew(SBSWatchdogAssertionRef assertion);
    CFTimeInterval SBSWatchdogAssertionGetRenewalInterval(SBSWatchdogAssertionRef assertion);

#pragma mark -

    CFArrayRef SBSCopyApplicationDisplayIdentifiers(Boolean onlyActive, Boolean unknown);

    CFStringRef SBSCopyIconImagePathForDisplayIdentifier(CFStringRef dispIden);
    CFStringRef SBSCopyLocalizedApplicationNameForDisplayIdentifier(CFStringRef dispIden);

    /*
     SB functions should be generated by MIG!

#pragma mark -
#pragma mark SB functions - Media
    void SBSetMediaVolume(mach_port_t port, int volume) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_3_0);

    void SBSetDisableNowPlayingHUD(mach_port_t port, Boolean disable) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_3_0);
    void SBSetNowPlayingInformation(mach_port_t port, void* info);

#pragma mark -
#pragma mark SB functions - Accessibility
    void SBSetZoomTouchEnabled(mach_port_t port, Boolean enable) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_3_0);
    void SBSetDisplayColorsInverted(mach_port_t port, Boolean inverted) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_3_0);

#pragma mark -
#pragma mark SB functions - Remote
    void SBApplicationSetSimpleRemoteRoutingPriority(mach_port_t port, int priority) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_3_0);

#pragma mark -
#pragma mark SB functions - Watchdog

    void SBCancelWatchdogAssertionForProcess(mach_port_t port, pid_t pid, void* unknown);

    void SBReloadApplication(mach_port_t port) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_3_0);
     */


#if __cplusplus
}
#endif

#endif 

这里是我的代码,我用我的ViewController.m文件:

#import "SpringBoardServices.h"


-(IBAction)AdSheed {

    SBSLaunchApplicationWithIdentifier(CFSTR("com.apple.preferences"), false);



}

没有人有一个想法,我怎么能解决这个问题?

Answer 1:

这是一个私人的框架。 你不应该使用它。 不使用方案你不能做到这一点。



文章来源: How to launch Applications without URL Schemes and without touching the icon on a non jailbroken iDevice?