[TOC]
一、fishhook
1、介绍
fishhook 是 facebook 出品的一个开源库。利用 mach-o 文件加载原理,通过 rebind_symbols 函数修改__DATA Segment 的符号指针指向,来动态的 Hook C 函数。
2、主要信息
2.1、结构体
struct rebinding {
const char *name; //函数名称
void *replacement; //新的函数地址
void **replaced; //保存原始函数地址变量的指针(通常要存储下来,在替换后的方法里调用)
};
2.2、主要接口
/*
交换方……继续阅读 »
sharezer
2年前 (2021-04-19) 1713浏览 0评论
0个赞
方法一: 用 applescript 获取
applescript 在开发中也非常好用。
tell application "System Events"
set listOfProcesses to every process
set allProcess to {}
repeat with processItem in listOfProcesses
set procname to name of processItem as string
set processId to unix id of processI……继续阅读 »
sharezer
2年前 (2021-04-15) 2073浏览 0评论
0个赞
// 显示Mac隐藏文件
defaults write com.apple.finder AppleShowAllFiles YES
// 隐藏Mac隐藏文件
defaults write com.apple.finder AppleShowAllFiles NO
// 强制使用集显
sudo pmset -a GPUSwitch 0
// 强制使用独显
sudo pmset -a GPUSwitch 1
// 自动切换模式
sudo pmset -a GPUSwitch 2
// 修改Mac地址
sudo ifconfig en0 ether [mac地址]
……继续阅读 »
sharezer
4年前 (2019-07-17) 1706浏览 0评论
0个赞
……继续阅读 »
sharezer
4年前 (2019-05-29) 1791浏览 0评论
0个赞
国内Specs
清华大学镜像
https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git
上海大学镜像
https://mirrors.shu.edu.cn/CocoaPods (仅HTTP/HTTPS访问,不支持git拉取)
https://mirrors.shu.edu.cn/mgit/Specs (仅git访问)
https://git.shuosc.org/CocoaPods/Specs (均支持)
中国区镜像表项
git://cocoapodscn.com/Specs.git
使用方法
对于旧版的 CocoaPods 可以……继续阅读 »
sharezer
4年前 (2019-05-01) 4884浏览 0评论
0个赞
废话不多说,直接上代码。
let options = PHImageRequestOptions()
options.version = PHImageRequestOptionsVersion.current;
options.deliveryMode = PHImageRequestOptionsDeliveryMode.highQualityFormat;
options.isSynchronous = true;
let phImageManager = PHImageManager.default()
phImageManager.requestImageData(for: phot……继续阅读 »
sharezer
5年前 (2018-12-02) 2134浏览 0评论
0个赞
新博客:
完整版 - AVFoundation Programming Guide
分章节版:
– 第 1 章:About AVFoundation - AVFoundation 概述
– 第 2 章:Using Assets - 使用 Assets
– 第 3 章:Playback - 播放
– 第 4 章:Editing - 编辑
– 第 5 章:Still and Video Media Capture - 静态视频媒体捕获
– 第 6 章:Export - 输出
– 第 7 章:Time and Media Representations 时间和媒体表现
版权声明:本文为博主原创翻译……继续阅读 »
sharezer
5年前 (2018-11-23) 5401浏览 0评论
0个赞
[TOC]
Android与iOS不嵌入微信SDK的情况上发送一份文件给微信好友。
1. iOS 一键分享
let activityVC = UIActivityViewController(activityItems: ["需要分享文件asset" as Any], applicationActivities: nil)
activityVC.popoverPresentationController?.sourceView = self.view
self.present(activityVC, animated: true, completion: nil)
效果如……继续阅读 »
sharezer
5年前 (2018-11-23) 2972浏览 0评论
0个赞
if captureFilePath != nil{
let image: NSImage = getImageFromURL(url: captureFilePath!)!
image.lockFocus()
NSColor.white.setStroke()
let height: Int = Int(image.size.height)
let width: Int = Int(image.size.width)
let lineWidth = CGFloat(height > width ? h……继续阅读 »
sharezer
7年前 (2016-12-13) 2765浏览 0评论
0个赞
@IBAction func SaveImage(_ sender: Any) {
if resuleImage.image != nil {
let savePanel = NSSavePanel.init()
savePanel.allowedFileTypes = [(captureFilePath?.pathExtension)!]
savePanel.message = "Choose the path to save the image"
savePanel.isExtensionHidden = false
……继续阅读 »
sharezer
7年前 (2016-12-13) 2490浏览 0评论
0个赞