V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  alaysh  ›  全部回复第 3 页 / 共 3 页
回复总数  58
1  2  3  
2020-11-27 17:29:47 +08:00
回复了 Jooooooooo 创建的主题 问与答 有办法能拿到 Mac 自带 preview 打开的 pdf 的进度吗?
~/Library//Containers/com.apple.Preview/Data/Library/Preferences/com.apple.Preview.ViewState.plist
找到文件对应 Key 的 Data,用 plist 格式解开,elementIndex 就是所需的值。

#import <Foundation/Foundation.h>
#include <sys/stat.h>

NSString *persistentIdForFileURL(NSURL *url) {
NSString *persistentId;

id value;
NSError *error;
BOOL res = [url getResourceValue:&value forKey:NSURLVolumeUUIDStringKey error:&error];
if (res) {
struct stat statBuf;
int res = stat(url.fileSystemRepresentation, &statBuf);
if (res == 0) {
persistentId = [NSString stringWithFormat:@"%@.%llu", value, statBuf.st_ino];
}
else {
NSLog(@"stat error: %d", res);
}
}
else {
NSLog(@"getResourceValue error:%@", error);
}
return persistentId;
}

int main(int argc, const char * argv[]) {
@autoreleasepool {
NSURL *url = [NSURL URLWithString:@"file:///tmp/1.pdf"];
NSString *persistentId = persistentIdForFileURL(url);

NSString *path = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, true)[0];
path = [path stringByAppendingString:@"/Containers/com.apple.Preview/Data/Library/Preferences/com.apple.Preview.ViewState.plist"];
NSData *data = [NSData dataWithContentsOfFile:path];

NSError *error;
NSDictionary *propertyList = [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListMutableContainers format:0 error:&error];
propertyList = propertyList[persistentId];
if (propertyList) {
data = propertyList[@"Data"];
propertyList = [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListMutableContainers format:0 error:&error];
if (propertyList) {
NSLog(@"propertyList: %@", propertyList);
}
else {
NSLog(@"propertyListWithData error:%@", error);
}
}
else {
if (error) {
NSLog(@"propertyListWithData error:%@", error);
}
NSLog(@"propertyList for %@ is null", url);
}
}
return 0;
}
2020-09-02 18:31:08 +08:00
回复了 iksapor 创建的主题 Apple iPhone 太旧,如何更新特定版本的 app?
iPhone 5s 以下型号最高只能 7.0.2 版本了
是这样的,当时刚出,我也发现了有爱奇艺的流量,马上卸载了
2019-07-10 10:55:17 +08:00
回复了 howtodie 创建的主题 问与答 暑假想去一个城市住到开学,不想回家
首先要保证自身安全
@jzphx apple 店好像只会换对应版本的硬件,我的是港版,他说要等港版配件到才能换
我不是针对谁,我是说在座的各位都是灰友
@Livid 真理,我已经用坏了 3 块 tf 卡,一块 u 盘了
2019-07-05 11:33:24 +08:00
回复了 xinge666 创建的主题 macOS “微信”中断了关机
微信:关什么机?继续工作!
2019-07-05 11:20:20 +08:00
回复了 WenjieYe 创建的主题 macOS 有用过 Mac 下微信小助手 WeChaTextension 的 V 友吗?
1. WeChatExtension/Sources/Hook/WeChat+hook.m
341 if (autoAuthEnable && [accountService canAutoAuth]) {
342 [accountService AutoAuth];
2. 底层是微信的代码,调用 autoauth 接口,类似断网后自动重连验证
3. 只要是用第三方客户端,没有有没有,只有想不想
@zhouweiluan 广州
@zhouweiluan 周四晚送去,周日晚已经通知可取了,还是很快的
@zhouweiluan 可以的
我的是港版机器,apple 店说没配件了,要 1 ~ 2 周
2019-05-24 15:23:12 +08:00
回复了 zcbenz 创建的主题 智能家电 米家传感器的反应时间?
可以不经过 homekit,米家 App 可以直接推送
小米门窗传感器=>小米网关=>灯 基本一开门灯就亮
小米门窗传感器=>小米网关=>推送 会延迟 2-3 秒左右
1  2  3  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2630 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 29ms · UTC 15:39 · PVG 23:39 · LAX 08:39 · JFK 11:39
Developed with CodeLauncher
♥ Do have faith in what you're doing.