1 工程创建和配置
签名配置问题1
- 由于项目是从uniapp离线打包工程来的,所以有些配置是已经存在的。创建工程时,Signing & Capabilities下的Signing报错:
HBuilder has conflicting provisioning settings.
HBuilder is automatically signed, but provisioning profile a7e03077-46db-4b91-b0c4-20fd613c1e14 has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor, or switch to manual signing in the Signing & Capabilities editor.
或者
HBuilder is automatically signed for development, but a conflicting code signing identity iPhone Distribution has been manually specified. Set the code signing identity value to "Apple Development" in the build settings editor, or switch to manual signing in the Signing & Capabilities editor.
处理:
找到工程的xcodeproj文件(比如app-demo-ios. xcodeproj),右键点击“显示包内容”,找到project.pbxproj文件,打开并搜索PROVISIONING_PROFILE,注释掉或者删除掉,保存并退出。问题即可解决。参考:
https://www.jianshu.com/p/c899d98f626e?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation
签名配置问题2
MAMapKit_3D_Demo has conflicting provisioning settings.
MAMapKit_3D_Demo is automatically signed, but code signing identity iPhone Distribution: AutoNavi Software Co., Ltd. has been manually specified. Set the code signing identity value to "Apple Development" in the build settings editor, or switch to manual signing in the Signing & Capabilities editor.
- 处理:
按照错误提示,在Build Settings 中设置profile(包括Release和Debug)都为"Apple Development" 即可。
签名配置问题3
(1)下载了某个demo工程,但是本地跑的时候,报错:
Unable to log in with account "[email protected]".
Sign in to try again.
参考:
https://www.jianshu.com/p/c6d15828b040?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation错误还有:
No profiles for 'com.amap.MAMapKit-3D-Demo.hh' were found
Xcode couldn't find any iOS App Development provisioning profiles matching 'com.amap.MAMapKit-3D-Demo.hh'.
参考:
https://www.jianshu.com/p/a3f652634152按照上面参考的进行处理:将project.pbxproj中的如下4条语句(OC和Swifit各两套,每套包括debug和release)删掉:
PROVISIONING_PROFILE_SPECIFIER = "";
- 右上角xcode --> preferences --> accounts
看到该账号下提示:
Your session has expired. Please log in.
但是重新登录没用。
- 参考:
https://blog.csdn.net/ws1352864983/article/details/52909346
(2) 该问题出现的第二种场景为:给已有的工程添加新的手机设备进行调试,但是报错,错误信息基本和第一种场景一样。
- 新手机devices安装ipa
The operation couldn’t be completed. Unable to log in with account '[email protected]'. The login details for account '[email protected]' were rejected.
Provisioning profile "iOS Team Provisioning Profile: com.app.demo" doesn't include the currently selected device "iPhone (6)" (identifier 89df990fbb855f2xxxxxxxxxxxxxxxx).
参考:
https://blog.csdn.net/aoiz62081/article/details/102110547
https://blog.csdn.net/chenftli/article/details/88593052
https://www.jianshu.com/p/c6d752f8fcac该问题未解决。
资源文件缺少导致编译失败
Unable to install “app-demo-ios”
“app-demo-ios” does not contain a valid Info.plist, so it cannot be installed on hh2的iPhone
(“CFBundleExecutable” is not specified)
Build input file cannot be found: '/Users/hh/Documents/ios-pro/iOSSDK-3.2.16/app-demo-ios/Application/[email protected]'
- 原因:即上面的[email protected]文件找不到,应该是迁移过来时,引用复制了,但是实际文件复制到。
- 处理:直接删除即可。
添加framework问题
在TARGETS的General下添加framework时,需要注意Embed状态。
注意:添加framework时,Embed需要设置为Do Not Embed状态。在TARGETS的Build Phases下的Link Binary With Libraries添加framework时,直接添加即可(Embed状态默认为Do Not Embed)。
2 开发问题
oc loadView
说明:loadView用来创建UIViewController的,调用时机在UIViewController被使用且该VC的view为nil的时候。所以loadView的调用后,才会调用viewDidLoad。
参考:
https://blog.csdn.net/wxs0124/article/details/80077143
ios更新升级跳转appstore
- 参考:
https://www.jianshu.com/p/cf4d55cd557e
获取iTunes id
- 处理:代码中通过如下bundle id获取对应的itunes id:
NSString *urlStr = @"http://itunes.apple.com/lookup?bundleId=com.app.demo";
- 获取返回的结果中找到trackId,即iTunes ID。
trackId = 9990000000;
- 注意:通过iTunes ID获取到的返回值也是基本一致的。
NSString *urlStr = @"http://itunes.apple.com/lookup?id= 9990000000";
说明:登录App Store Connect,找到对应的APP应用,查看APP信息,也能看到其iTunes ID(即APP ID)。
参考:
https://www.it1352.com/1936946.html
iPhone在设备上启用网页检查器
- 参考:
https://jingyan.baidu.com/article/2f9b480d61de3201ca6cc219.html
iOS跳转到位置服务
- 参考:
https://www.jianshu.com/p/0aa1d86867da
https://www.zhihu.com/question/22547247/answer/101986288
https://www.jianshu.com/p/0200b6cce1a7
ios应用配置定位权限但是设置里没有显示
参考:
https://www.jianshu.com/p/1b94a0647971
https://ask.dcloud.net.cn/question/86633
接入微信支付库:编译报错
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_PayResp", referenced from:
objc-class-ref in libwxpay.a(PGWXPay.o)
"_OBJC_CLASS_$_PayReq", referenced from:
objc-class-ref in libwxpay.a(PGWXPay.o)
处理:根据uniapp离线APP官方文档。
微信支付,如下3个库是绑定使用的:
liblibPayment.a、libwxpay.a、libWeChatSDK_pay.a参考:
https://blog.csdn.net/qq_25862091/article/details/80264946
https://blog.csdn.net/weixin_30541591/article/details/88784678
Undefined symbols for architecture arm64:
- 参考:
https://www.jianshu.com/p/7402d0b948db
https://www.jianshu.com/p/d9b3c5a845a2
https://blog.csdn.net/zuoyou1314/article/details/46638073
Xcode缓存是什么
- 随着开发工作的与日俱增,Xcode的缓存也会越来越多,所以定期清理一下缓存还是很有必要的。特别是Macbook磁盘容量不够的情况下,清理缓存带来的效果尤为显著。
比如:
~/Library/Developer/Xcode/Archives
~/Library/Developer/Xcode/DerivedData
说明:第一个为Archive打ipa包的历史记录,第二个为模拟器运行程序产生的数据。
- 参考:
https://www.jianshu.com/p/dd18390f4b37
oc系统定位
参考:
https://www.cnblogs.com/sundaysgarden/articles/10318100.html
https://www.jianshu.com/p/fa5220bc6677oc系统定位获取不到
参考:
https://blog.csdn.net/Jayant_Y/article/details/52021813
看日志,信息如下:
2022-03-09 08:30:20.484257+0800 app-demo-ios[4711:1526967] A location manager (0x108f0caa0) was created on a dispatch queue executing on a thread other than the main thread. It is the developer's responsibility to ensure that there is a run loop running on the thread on which the location manager object is allocated. In particular, creating location managers in arbitrary dispatch queues (not attached to the main queue) is not supported and will result in callbacks not being received.
说明:需要在主线程触发获取定位操作,特别是CLLocationManager一定要在主线程里创建,在其他线程不支持且不会返回回调。
获取定位日志:
使用有一次性定位:这个时间间隔有点久。
2022-03-09 08:50:07.678619+0800 app-demo-ios[4785:1537452] getCurrenLocation.enable:1
2022-03-09 08:50:17.682124+0800 app-demo-ios[4785:1537452] didUpdateLocations locations.count:1, lo:<+28.21871726,+113.15477040> +/- 65.00m (speed -1.00 mps / course -1.00) @ 2022/3/9 中国标准时间 上午8:50:14
2022-03-09 08:50:17.682456+0800 app-demo-ios[4785:1537452] setCurrentLocation:113.1547703983427,28.21871725630077
使用多次定位:这个时间间隔非常短。只要在获取到定位的回调里停止定位即可。
2022-03-09 08:54:35.627507+0800 app-demo-ios[4802:1540059] getCurrenLocation.enable:1
2022-03-09 08:54:35.644677+0800 app-demo-ios[4802:1540059] didUpdateLocations locations.count:1, lo:<+28.21869956,+113.15483123> +/- 65.00m (speed -1.00 mps / course -1.00) @ 2022/3/9 中国标准时间 上午8:52:51
:35.644746+0800 app-demo-ios[4802:1540059] setCurrentLocation:113.1548312250047,28.21869955594153
2022-03-09 08:54:35.653389+0800 app-demo-ios[4802:1540059] didUpdateLocations locations.count:1, lo:<+28.21869956,+113.15483123> +/- 65.00m (speed -1.00 mps / course -1.00) @ 2022/3/9 中国标准时间 上午8:53:00
2022-03-09 08:54:35.653436+0800 app-demo-ios[4802:1540059] setCurrentLocation:113.1548312250047,28.21869955594153
__weak typeof
- 参考:
https://www.jianshu.com/p/bf40bf7fe207
iOS开屏视频设置/ iOS应用启动动画
- 参考:
https://blog.csdn.net/chuan403082010/article/details/68958453
uni.chooseFile iOS
说明:这里用到了Native.js插件,然后通过拷贝到沙盒目录再对文件路径进行处理即可。
参考:
https://www.jianshu.com/p/798d15d1c42e
微信文件上传ios实现
- 参考:
https://blog.csdn.net/weixin_40009393/article/details/111838370
微信文件获取ios
参考:
https://www.jianshu.com/p/1d07fab48e67?appinstall=0iOS像微信那样获取APP内部的文件
参考:
https://www.freesion.com/article/1072318981/
https://www.cnblogs.com/wj033/p/6351232.html
UIDocument
- 参考:
https://www.jianshu.com/p/857f5f917dab
getTopViewController
- 参考:
https://blog.csdn.net/zgpeace/article/details/108237716
https://www.jianshu.com/p/804d603085b2
UIDocumentPickerViewController
参考:
https://blog.csdn.net/u014084081/article/details/94563298
https://blog.csdn.net/Lu_Ca/article/details/109490842?spm=1001.2101.3001.6661.1&utm_medium=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1.pc_relevant_default&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1.pc_relevant_default&utm_relevant_index=1如上,获取iPhone文件中的文件:
2022-04-06 21:14:13.841263+0800 app-demo-ios[6427:2247924] sy.appL documentPicker: url:file:///private/var/mobile/Containers/Data/Application/65F30A07-0B32-45F3-BA73-86DFDBA4149F/tmp/com.app.demo-Inbox/fileuploadtext.txt
拷贝文件失败:
2022-04-06 22:18:02.363673+0800 app-demo-ios[441:25968] sy.app: copyFileToSanbox fail: filePth:file:///private/var/mobile/Containers/Data/Application/4B978759-D78A-406D-8583-6318C4AF0E9F/tmp/com.app.demo-Inbox/fileuploadtext.txt, toPath:/var/mobile/Containers/Data/Application/4B978759-D78A-406D-8583-6318C4AF0E9F/Documents/fileuploadtext.txt, error:Error Domain=NSCocoaErrorDomain Code=260 "未能打开文件“fileuploadtext.txt”,因为它不存在。" UserInfo={NSFilePath=file:///private/var/mobile/Containers/Data/Application/4B978759-D78A-406D-8583-6318C4AF0E9F/tmp/com.app.demo-Inbox/fileuploadtext.txt, NSUnderlyingError=0x280612790 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
- 处理:需要处理文件路径前的file:///
这里需要判断并去掉。
error:Error Domain=NSCocoaErrorDomain Code=260 "未能打开文件“fileuploadtext.txt”,因为它不存在。"
- 参考:
https://blog.csdn.net/wn2utt18/article/details/121381266
NSFilePath=file:///private/var/mobile/Containers/Data/Application/BAFA56AA-712D-49EE-948D-3281699C2C83/tmp/com.app.demo-Inbox/fileuploadtext.txt, NSUnderlyingError=0x281fec2a0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory
- 参考:
https://zhuanlan.zhihu.com/p/388529576
@avaiable
- 参考:
https://www.jianshu.com/p/d35bc67e6e04?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes
UIPopoverPresentationController
- 参考:
https://www.jianshu.com/p/bcc2f6ca4708
https://www.jianshu.com/p/422dd88b25b1
https://www.jianshu.com/p/3cf49696fcb8
oc获取文件属性
- 文件属性:日志:
Printing description of attrs:
{
NSFileCreationDate = "2022-04-06 13:08:23 +0000";
NSFileExtendedAttributes = {
"com.apple.lastuseddate#PS" = {length = 16, bytes = 0x7b51546200000000f560ab2800000000};
};
NSFileExtensionHidden = 0;
NSFileGroupOwnerAccountID = 501;
NSFileGroupOwnerAccountName = mobile;
NSFileModificationDate = "2022-04-06 13:08:23 +0000";
NSFileOwnerAccountID = 501;
NSFileOwnerAccountName = mobile;
NSFilePosixPermissions = 384;
NSFileProtectionKey = NSFileProtectionCompleteUntilFirstUserAuthentication;
NSFileReferenceCount = 1;
NSFileSize = 16;
NSFileSystemFileNumber = 50664303;
NSFileSystemNumber = 16777224;
NSFileType = NSFileTypeRegular;
}
- 参考:
https://blog.csdn.net/u012701023/article/details/47145889
https://www.jianshu.com/p/033489765d93
oc字符串过滤器:NSPredicate
- 参考:
https://www.cnblogs.com/self-epoch/p/16061696.html
https://blog.csdn.net/zhang522802884/article/details/76889748
UIButton图片文字位置
- 参考:
https://www.jianshu.com/p/0a56837cdbb8
https://www.likecs.com/show-305743093.html
https://blog.csdn.net/SHJSir/article/details/74474687
UIButton改变图片大小
- 参考:
https://blog.csdn.net/zhanghaibo369/article/details/117367489
startAccessingSecurityScopedResource
- 参考:
http://www.skyfox.org/cocoa-macos-sandbox.html
DocumentTypes
- 参考:
https://blog.csdn.net/youshaoduo/article/details/79402931
https://developer.apple.com/library/archive/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html#//apple_ref/doc/uid/TP40009259
ios的encodeurl和decodeurl
- 参考:
https://www.jianshu.com/p/5c853fa9fa98
NSURLSession下载
- 参考:
https://www.jianshu.com/p/18a6062f2ebb
https://www.jianshu.com/p/3b74517f6a2b
https://www.jianshu.com/p/5a07352e9473
NSURLSessionDownloadTask下载文件大小为0
- 参考:
暂时没问题,问题出在uni.downlown和uni.saveFile代码逻辑里。
colorWithRed宏写法
- 参考:
https://blog.csdn.net/Vic__li/article/details/50061233
NSDateFormatter
- 参考:
https://www.jianshu.com/p/a2c7e1a85192
https://blog.csdn.net/Llingmiao/article/details/78799480
sortUsingComparator
- 参考:
https://www.codenong.com/12370210/
sortUsingComparator比较NSDate
- 参考:
https://blog.csdn.net/lvwuxue/article/details/48346903
https://www.jianshu.com/p/61383623bb46
UItableView不显示hightlight
- 参考:
https://blog.csdn.net/zhgcrichard/article/details/8844790
ios刘海屏和非刘海屏获取状态栏高度
- 参考:
https://codeleading.com/article/39572614575/
https://www.jianshu.com/p/f79970b3e03b
https://www.jianshu.com/p/17a49d30e0e4
oc预览文件
- 参考:
https://www.cnblogs.com/lrr0618/p/13470086.html
https://www.jianshu.com/p/998e045b930f?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation
oc hitTest
- 参考:
https://blog.csdn.net/songzhuo1991/article/details/117123181
CGRectContainsRect
- 参考:
https://blog.csdn.net/jeffasd/article/details/51222548
OC扩大按钮的点击范围
处理:
使用pointInSide需要用UIView的bounds,而不是frame。参考:
https://www.cnblogs.com/itlover2013/p/15174495.html
https://blog.csdn.net/eastWind1101/article/details/110790935
https://blog.csdn.net/sinat_36521092/article/details/81350845?spm=1001.2101.3001.6650.2&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-2.pc_relevant_default&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-2.pc_relevant_default&utm_relevant_index=5
Docment Types配置
- 参考:
https://www.jianshu.com/p/2edfacf2cd1e
https://blog.csdn.net/chugang6852/article/details/100757134
https://www.jianshu.com/p/68d8b7f174a9
UIviewcontroller设置透明背景显示黑色
- 参考:
https://www.jianshu.com/p/bbb128443039
UIModalPresentationOverFullScreen和UIModalPresentationFullScreen
- 参考:
https://blog.csdn.net/victor_barnett/article/details/51791580
https://www.thinbug.com/q/29022149
http://www.tilaile.com/question/21143
OC类型问题
Passing 'const NSString * _Nonnull __strong' to parameter of type 'NSString * _Nonnull __strong' discards qualifiers
- 两种正确的写法:
const static NSString *TableID = @"table";
static NSString * const TableIDCall = @"call";
- 参考:
https://www.jianshu.com/p/2214233b2d44
oc random
一句话总结:。
参考:
https://blog.csdn.net/xfxf996/article/details/82842196
腾讯OCR:导入framework问题
Undefined symbol: _OBJC_CLASS_$_MLDictionaryFeatureProvider
Undefined symbol: _OBJC_CLASS_$_MLMultiArray
Undefined symbol: _OBJC_CLASS_$_MLModel
- 原因:和OcrDemo工程对比了一下,发现是CoreML.framework库未导入导致的。这是一个系统库。
- 处理:导入该库,编译正常。
获取本地文件地址
- 获取本地文件地址,然后传给前端,报错:
2022-08-15 17:56:54.690875+0800 app-demo-ios[1069:210438] [error]DCImageComponent.mm:556, Error downloading image: /var/mobile/Containers/Data/Application/21FBD746-1859-4569-AC2A-90A593647A21/Library/Caches/OcrFiles/image_1660557414.jpg, detail:不支持的URL
- 处理:需要在地址前加file://前缀
3 Pod
mac安装cocoapods失败
- 安装cocoapods,版本1.9.3
sudo gem install cocoapods -v 1.9.3
- 报错:
hh@hhdeMacBook-Pro-2 NoteBook % sudo gem install cocoapods -v 1.9.3
Fetching thread_safe-0.3.6.gem
Fetching i18n-0.9.5.gem
Fetching tzinfo-1.2.9.gem
Fetching ffi-1.15.5.gem
Fetching ethon-0.15.0.gem
Fetching activesupport-4.2.11.3.gem
Fetching cocoapods-core-1.9.3.gem
Fetching claide-1.1.0.gem
Fetching cocoapods-stats-1.1.0.gem
Fetching molinillo-0.6.6.gem
Fetching ruby-macho-1.4.0.gem
Fetching cocoapods-1.9.3.gem
Successfully installed thread_safe-0.3.6
Successfully installed tzinfo-1.2.9
Successfully installed i18n-0.9.5
Successfully installed activesupport-4.2.11.3
Building native extensions. This could take a while...
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20220303-25236-1dhr2lh.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
--with-ffi_c-dir
--without-ffi_c-dir
--with-ffi_c-include
--without-ffi_c-include=${ffi_c-dir}/include
--with-ffi_c-lib
--without-ffi_c-lib=${ffi_c-dir}/lib
--enable-system-libffi
--disable-system-libffi
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:546:in `block in try_link0'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/tmpdir.rb:93:in `mktmpdir'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:543:in `try_link0'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:570:in `try_link'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:672:in `try_ldflags'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1832:in `pkg_config'
from extconf.rb:9:in `system_libffi_usable?'
from extconf.rb:42:in `'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/ffi-1.15.5/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/ffi-1.15.5/gem_make.out
参考:
https://www.jianshu.com/p/57b599e48ba2mac安装ruby
参考:
https://www.jianshu.com/p/bbe6d6860881安装ruby报错:
hh@hhdeMacBook-Pro-2 NoteBook % brew install rbenv
Error: Can't create update lock in /usr/local/var/homebrew/locks!
Fix permissions by running:
sudo chown -R $(whoami) /usr/local/var/homebrew
Warning: You are using macOS 11.6.
We do not provide support for this pre-release version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Discourse, Twitter or IRC. You are responsible for resolving any issues you
experience while you are running this pre-release version.
Error: The following directories are not writable by your user:
/usr/local/etc/bash_completion.d
/usr/local/lib/pkgconfig
/usr/local/share/aclocal
/usr/local/share/info
/usr/local/share/locale
/usr/local/share/man/man8
/usr/local/share/zsh
/usr/local/share/zsh/site-functions
/usr/local/var/homebrew/locks
You should change the ownership of these directories to your user.
sudo chown -R $(whoami) /usr/local/etc/bash_completion.d /usr/local/lib/pkgconfig /usr/local/share/aclocal /usr/local/share/info /usr/local/share/locale /usr/local/share/man/man8 /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew/locks
And make sure that your user has write permission.
chmod u+w /usr/local/etc/bash_completion.d /usr/local/lib/pkgconfig /usr/local/share/aclocal /usr/local/share/info /usr/local/share/locale /usr/local/share/man/man8 /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew/locks
- 加sudo执行命令,报错:
hh@hhdeMacBook-Pro-2 NoteBook % sudo brew install rbenv
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.
注意:ruby自带:
hh@hhdeMacBook-Pro-2 NoteBook % ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]ruby安装cocoapods
参考:
https://www.jianshu.com/p/586edc5c57a7
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
参考:
https://www.jianshu.com/p/9c9f8d4867eb
https://www.jianshu.com/p/21afa0ae67dc原因:根据上面参考资料可知,版本太低导致,而cocoapods版本1.9.3需要比较高的ruby版本。目前本级ruby版本太低了,所以降级使用cocoapods版本1.8.3
处理:执行如下命令,成功:
sudo gem install cocoapods -v 1.8.3
YYModel:pod失败
Installing YYModel (1.0.4)
[!] Error installing YYModel
[!] /usr/bin/git clone https://github.com/ibireme/YYModel.git /var/folders/xf/xsz954hn761_n1wvrw3wpl7m0000gn/T/d20220810-20357-1io0n3z --template= --single-branch --depth 1 --branch 1.0.4
Cloning into '/var/folders/xf/xsz954hn761_n1wvrw3wpl7m0000gn/T/d20220810-20357-1io0n3z'...
error: RPC failed; curl 16 Error in the HTTP2 framing layer
fatal: error reading section header 'shallow-info'
- 问题:该问题未解决。暂时不引入YYModel。
- 参考:
https://gitee.com/mirrors/YYModel?utm_source=alading&utm_campaign=repo
gitignore
- .gitignore文件是在git上传时过滤不需要提交的文件的。示例如下:
#CocoaPods
Pods/
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
# Mac OS X Finder and whatnot
.DS_Store
## Build generated
build/
- 参考:
https://blog.csdn.net/weixin_45318845/article/details/120740012
https://www.51sjk.com/b20b282346/
https://www.jianshu.com/p/863743b5b993
4 调试,打包,上架
ios开发证书生成p12( ios导出p12)
- 参考:
https://blog.csdn.net/tieshuxianrezhang/article/details/72835963
https://blog.csdn.net/qq_36487644/article/details/103212391
https://www.cnblogs.com/ywkpl/p/9110702.html
iOS开发/发布证书导出证书描述文件
- 参考:
https://www.jianshu.com/p/431ed0536754
https://blog.csdn.net/weixin_39683734/article/details/111530447
ios开发组团队添加账号
说明:
在iOS开发组团队添加账号之后,Apple会给开发者发送确认邮件(邮件主题为You're invited to join a development team.),首先需要点击确认(这个会进入苹果开发者网站进行验证/确认),其次开发组团队需要对该加入的账号授予相应的权限,不然开发者账号不会显示加入的开发组团队(Accounts--Team)。参考:
https://www.jianshu.com/p/3afe646a8250
iOS真机调试,运行报错:
Showing Recent Messages
The network connection was lost.
//还有一句错误未复制到。
- 说明:
调试真机未包含在开发组团队的设备管理列表中。
修改工程文件夹路径名:
error: Build input file cannot be found: '/Users/hh/Documents/ios-pro/iOSSDK-3.2.16/app-demo-ios/HBuilder-Hello/HBuilder-Hello-Prefix.pch' (in target 'app-demo-ios' from project 'app-demo-ios')
- 处理:
修改HBuilder-Hello-Info.plist和HBuilder-Hello-Prefix.pch
打ipa包:Archive执行报错:
Showing Recent Messages
Undefined symbol: _OBJC_CLASS_$_UMZid
ld: warning: could not create compact unwind for _ffi_call_unix64: does not use RBP or RSP based frame
ld: warning: Could not find or use auto-linked framework 'AVFAudio'
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_UMZid", referenced from:
objc-class-ref in UMCommon(UMConfigure.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
- 参考:
https://blog.csdn.net/fanyong245758753/article/details/53909708
团队开发账户导出ipa
参考:
https://www.jianshu.com/p/a743a7e5864c执行命令,报错:
xcodebuild -exportArchive -exportFormat ipa -archivePath ./app-demo-ios\ 2021-12-7,\ 3.20\ PM.xcarchive ./test.ipa
xcodebuild: error: invalid option '-exportFormat'
参考:
https://blog.csdn.net/zhangxiweicaochen/article/details/72730355
https://www.jianshu.com/p/29fc7d1bbb57执行:
xcodebuild -exportArchive :exportOptionsPlist -archivePath ./app-demo-ios\ 2021-12-7,\ 3.20\ PM.xcarchive ./test.ipa
xcodebuild: error: The flag -exportOptionsPlist is required when specifying -exportArchive.
参考:
https://magicalboy.com/xcodebuild-usage
https://blog.csdn.net/hdwhappy/article/details/60767078xcodebuild -exportArchive生成ipa
参考:
https://www.jianshu.com/p/e04c3b7f57f6执行,报错:
xcodebuild -exportArchive app-demo-ios\ 2021-12-7,\ 3.20\ PM.xcarchive -exportPath test.ipa
xcodebuild: error: The flag -exportOptionsPlist is required when specifying -exportArchive.
xcodebuild: error: The flag -archivePath is required when specifying -exportArchive.
- 重新执行,报错:
xcodebuild -exportArchive -archivePath app-demo-ios\ 2021-12-7,\ 3.20\ PM.xcarchive -exportPath test.ipa
xcodebuild: error: The flag -exportOptionsPlist is required when specifying -exportArchive.
原因:需要导出exportOptionsPlist,导出一份plist文件
参考:
https://jingyan.baidu.com/article/11c17a2cdcb4c9f446e39dbe.html结论:
在执行,然后弹出ipa输出包弹框,然后发布ipa时选择第4个,开发者选项(),再点击下一步(选自动,不要选手动),就可以导出了。
导出之后,就有ipa包,然后使用iTools安装,成功。
换一个新手机,运行xcode,弹框:需要注册设备:
Device "“win10”的 iPhone" isn't registered in your developer account.
The device must be registered in order to be included in a provisioning profile.
Showing Recent Messages
Provisioning profile "iOS Team Provisioning Profile: com.app.demo" doesn't include the currently selected device "“win10”的 iPhone" (identifier e05f0b5d290c73bf9f00ca6a8fbceffe4066adad).
- 说明:这个是Xcode注册设备到苹果开发账号,直接点确认即可。
- 参考:
https://zhuanlan.zhihu.com/p/72103102
https://www.jianshu.com/p/f31116a76ea9
xcode 版本和手机系统不匹配(需要升级xcode,目前手机系统新的iPhone都在iOS14.8以上,iOS15以上)。
iPhonesm is not available.
Please reconnect the device.
- 参考:
https://www.jianshu.com/p/09f67a4cb039
iOS包ipa安装失败
无法安装“应用内部版”
无法安装此App,因为无法验证其完整性。
注意:该问题是iOS开发调试设备时经常会遇到的问题。
说明:uuid已添加到苹果开发者账号后台但仍然无法安装此app因为无法验证其完整性
原因:uuid(UDID)需要先注册添加(通过Xcode来注册最可靠),再打ipa包提供安装。
参考:
https://zhidao.baidu.com/question/1903176824428431820.html
https://blog.csdn.net/wangyajuncsd/article/details/115533339
https://zhidao.baidu.com/question/2210488255906357948.html
https://www.jianshu.com/p/a3eb50c22117?ivk_sa=1025922x
真机调试问题:
Failed to prepare device for development.
This operation can fail if the version of the OS on the device is incompatible with the installed version of Xcode. You may also need to restart your mac and device in order to correctly detect compatibility.
- 处理:重启手机。
- 参考:
https://www.jianshu.com/p/798785608df8
Xcode 运行报错
错误信息:
hh2的iPhone is not available.
Please reconnect the device.
查看 Xcode -- Window -- Device And Simulator
有如下报错信息:
Failed to prepare device for development.
If you are certain that Xcode supports development on this device, try disconnecting and reconnecting the device.
- 查看具体报错信息:
NSLocalizedFailure = "This operation can fail if the version of the OS on the device is newer than the version of Xcode that is running.";
结论:iOS版本和Xcode版本不匹配导致的。
两种方案:一是更新xcode,一是使用模拟器。
第三种投机取巧方案:拷贝xcode需要支持的iOS版本到xcode对应的路径下,具体参考如下:
https://www.jianshu.com/p/09f67a4cb039参考:
https://www.jianshu.com/p/09f67a4cb039
https://www.jianshu.com/p/e519550056a0
苹果开发者官网发布应用(ios应用上架)
具体见iOS Archive打包ipa以及上架Apple Store
(1) 参考:
https://www.jianshu.com/p/b4f284de459e
https://www.yubaibai.com.cn/article/5612211.html
https://zhuanlan.zhihu.com/p/104987262
官方文档:
http://help.apple.com/xcode/mac/current/#/devba7f53ad4
https://help.apple.com/app-store-connect/#/dev34e9bbb5a
官方文档:App 审核:
https://developer.apple.com/app-store/review/
(2) Xcode Archive页面
参考:
https://www.jianshu.com/p/9eb133053a64
(3) ios应用上架错误
具体见iOS Archive打包ipa以及上架Apple Store
(4) 怎么进入iTunes connect
- 说明:目前没有iTunes connect了,iOS APP发布直接走App Store Connect。
- 参考:
https://jingyan.baidu.com/article/7f766daff39bcb4101e1d093.html
(5) Xcode下载问题:
我们未能完成您的购买。
可用的磁盘空间不足,无法安装此产品。
处理:从APPleStore下载Xcode,一定要磁盘容量留出超过45G才行。
- 参考:
https://www.jianshu.com/p/fe17d3d965b1
https://www.jianshu.com/p/277d906ab76f
(6) 删除testflight提交的版本
说明:暂时没有办法删除已经发布上传test flight所提交的版本。如果testflight所提交的版本有问题,可以重新发布上传,而在审核的时候选择正确的构建版本即可。
参考:
https://www.jianshu.com/p/02daf21ad3df
https://tieba.baidu.com/p/7203316769
(7) testflight的app怎么发布到appstore
说明:由于testflight里的app版本,需要进行验证完才能显示出来。所以appstore connect里在选择的构建版本一定是要testflight已经验证完的版本。
参考:
https://www.jianshu.com/p/52871d77f30f
(8) iTunes connect
- 参考:
https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/wa/bookSignup
(9) Xcode archive发布应用
注意:
发布应用需要在Edit scheme里修改Build Configuraiton模式为
release(调试一般为debug)参考:
https://www.jianshu.com/p/c4b9e636a29e
(10)Xcode13发布应用到App Store
- 说明:发布应用到APP Store一律走App Store Connect。
- 参考:
https://www.jianshu.com/p/767ab0f5c8e9
https://www.cnblogs.com/edensyd/p/9441890.html
Apple Store Connect协议条款
Review the updated Paid Applications Schedule.
In order to update your existing apps, create new in-app purchases, and submit new apps to the App Store, the user with the Legal role (Account Holder) must review and accept the Paid Applications Schedule (Schedule 2 to the Apple Developer Program License Agreement) in the Agreements, Tax, and Banking module.
To accept this agreement, they must have already accepted the latest version of the Apple Developer Program License Agreement in their account on the developer website.
说明:Apple Store Connect这里有个协议需要同意才能发布等操作。但是这里只能是账户持有者(Account Holder)才能处理,其他角色没有这个权限。
参考:
https://www.pianshen.com/article/33581174442/
ios发布找不到构建版本
- 问题描述:
1) ios发布到testflight但是看不到
2)applestore connect找不到构建版本
applestore connect显示信息:
从多种工具中选取一种来上传您的构建版本。查看上传工具
参考:
https://blog.csdn.net/huanghaiyan_123/article/details/48193863
https://www.jianshu.com/p/1611c48a3d71处理:根据苹果审核构建版本的邮件,可知,需要在Info.plist中添加NSCameraUsageDescription这个key。
说明:如果ios发布(Archive上传成功,但不一定就能发布),一段时间(验证时间)内仍然在applestore connect找不到构建版本,就需要找邮件或者其他途径看看是不是有报错信息。然后根据报错信息(如上为照相机权限未申请)修改代码再重新发布。
上架问题:
App Store Connect Operation Error
ERROR ITMS-90101: "This bundle does not support one or more of the devices supported by the previous app version. Your app update must continue to support all devices previously supported. You declare supported devices in Xcode with the Targeted Device Family build setting. Refer to QA1623 for additional information: https://developer.apple.com/library/ios/#qa/qa1623/_index.html"
处理:
去掉iPad选项,导致的问题。同时修改如下配置(去掉iPad)
"@platforms":["android","iPhone","iPad"]注意:这里是uniapp离线工程,上面的配置是uniapp工程里的manifest.json配置文件的参数。
参考:
https://blog.csdn.net/qq_15023917/article/details/100733524
applestore审核
您的 App 包含 NSUserTrackingUsageDescription,这表示您将会请求追踪用户。要在 App 产品页上发布此信息,您必须注明哪些数据类型会追踪用户。如果此描述有误,请更新您的 App 二进制文件,并将新的构建版本上传到 App Store Connect。
- 参考:
https://blog.csdn.net/gwh111/article/details/121178288
https://www.cnblogs.com/e0yu/p/14785158.html
https://ask.dcloud.net.cn/article/36107
Apple Connect:Register an App ID
这个是为新建APP填写套装ID用的。
套装ID如果找不到对应的APPID,可以通过链接跳转到注册页面。处理:
Description:简要填写APP信息
Bundle ID:选择Explicit(默认),填写报名
Capabilities:复选:
(1)用户版本
Access WiFi Information
Associated Domains
Data Protection:选择Complete Protection
In-App Purchase(默认选择,用户不可选)
Push Notifications
Sign In with Apple
(2)内部版
Associated Domains
Inter-App Audio
In-App Purchase(默认选择,用户不可选)
Push Notifications
Sign In with Apple
(3)注意:除了In-App Purchase(默认选择,用户不可选)之外,其他的都可以重新选择
Apple Connect:新建App
- 处理:
平台:选择iOS
名称:填写APP名称
主要语言:选择简体中文
套装ID:从上面Register an ID里选择一个AppID
SKU:这个自定义即可
用户访问权限:选择“完全访问权限”
5 推送
ios申请推送服务
- 参考:
http://t.zoukankan.com/panshengneng-p-3954916.html
https://www.likecs.com/show-204351632.html
https://www.jianshu.com/p/def6a1c9d3a6
https://www.jianshu.com/p/2df93cce5139
推送证书
Apple Push Notification service SSL Certificates
To configure push notifications for this App ID, a Client SSL Certificate that allows your notification server to connect to the Apple Push Notification Service is required. Each App ID requires its own Client SSL Certificate. Manage and generate your certificates below.
Development SSL Certificate
Create an additional certificate to use for this App ID.
Create Certificate
Production SSL Certificate
Create an additional certificate to use for this App ID.
Create Certificate
- 参考:
https://www.jianshu.com/p/2df93cce5139
生成APNs后端推送证书
- 参考:
https://www.jianshu.com/p/e354138476ac
创建证书:
Certificates, Identifiers & Profiles
All Certificates
Create a New Certificate
Certificate Type
Apple Push Notification service SSL (Sandbox)
Upload a Certificate Signing Request
To manually generate a Certificate, you need a Certificate Signing Request (CSR) file from your Mac.
Learn more
- 参考:
https://help.apple.com/developer-account/#/devbfa00fef7
6 其他
腾讯云:IM通讯
- 参考:
https://cloud.tencent.com/document/product/269/2570