Anchors in help-book not working

前端 未结 2 1341
被撕碎了的回忆
被撕碎了的回忆 2021-02-06 06:17

I\'ve double checked everything and hoping someone can find a stupid mistake that I\'m not seeing.

I\'m trying to build a Apple Help section for my application and it co

2条回答
  •  伪装坚强ぢ
    2021-02-06 07:09

    If Everything is proper and and still if help does not work use code below. Not sure about the security concerns thou,you might have to research on deleting files from app. Sometimes app on upgrade does not update the help files and display the cached copy of older help file, which do not contain new anchors. Hence code below clears help cache. Also theres another cleaner method where in you increment the build version of help file in Info.plist which is inside the help bundle not the app info plist. Those fields are CFBundleShortVersionString CFBundleVersion

    -(void)clearCacheHelp {
    NSArray *arguments1 = [NSArray arrayWithObjects:@"helpd",nil];
    
    NSTask * list1 = [[NSTask alloc] init];
    [list1 setLaunchPath:@"/usr/bin/killall"];
    [list1 setArguments:arguments1];
    
    
    NSPipe * out1 = [NSPipe pipe];
    [list1 setStandardOutput:out1];
    
    [list1 launch];
    [list1 waitUntilExit];
    
    
    NSString *home = [self homeDirectory];
    
    home = [home stringByAppendingPathComponent:@"Library/Caches/com.apple.helpd"];
    
    NSArray *arguments  = [NSArray arrayWithObjects:@"-rf",home,nil];
    
    
    NSTask * list = [[NSTask alloc] init];
    [list setLaunchPath:@"/bin/rm"];
    [list setArguments:arguments];
    
    
    NSPipe * out = [NSPipe pipe];
    [list setStandardOutput:out];
    
    [list launch];
    [list waitUntilExit];
    
    
    
    NSString *home2 = [self homeDirectory];
    
    home2 = [home2 stringByAppendingPathComponent:@"Library/Caches/com.apple.helpviewer"];
    
    NSArray *arguments2  = [NSArray arrayWithObjects:@"-rf",home2,nil];
    
    
    NSTask * list2 = [[NSTask alloc] init];
    [list2 setLaunchPath:@"/bin/rm"];
    [list2 setArguments:arguments2];
    
    
    NSPipe * out2 = [NSPipe pipe];
    [list2 setStandardOutput:out2];
    
    [list2 launch];
    [list2 waitUntilExit];
    
    
    NSArray *arguments3  = [NSArray arrayWithObjects:@"-rf",@"~/Library/Caches/com.apple.helpd",nil];
    
    
    NSTask * list3 = [[NSTask alloc] init];
    [list3 setLaunchPath:@"/bin/rm"];
    [list3 setArguments:arguments3];
    
    
    NSPipe * out3 = [NSPipe pipe];
    [list3 setStandardOutput:out3];
    
    [list3 launch];
    [list3 waitUntilExit];
    
    
    NSArray *arguments4  = [NSArray arrayWithObjects:@"-rf",@"~/Library/Caches/com.apple.helpviewer",nil];
    
    
    NSTask * list4 = [[NSTask alloc] init];
    [list4 setLaunchPath:@"/bin/rm"];
    [list4 setArguments:arguments4];
    
    
    NSPipe * out4 = [NSPipe pipe];
    [list4 setStandardOutput:out4];
    
    [list4 launch];
    [list4 waitUntilExit];
    
    
    }
    

提交回复
热议问题