dyld: Library not loaded: @rpath/libswiftCore.dylib
Referenced from: /private/var/mobile/Containers/Bundle/Application/D2DB1777-DDBC-4616-95A4-D6B5A0176508/BaiKeLive.app/BaiKeLive
Reason: no suitable image found. Did find:
/private/var/mobile/Containers/Bundle/Application/D2DB1777-DDBC-4616-95A4-D6B5A0176508/BaiKeLive.app/Frameworks/libswiftCore.dylib: code signature invalid for '/private/var/mobile/Containers/Bundle/Application/D2DB1777-DDBC-4616-95A4-D6B5A0176508/BaiKeLive.app/Frameworks/libswiftCore.dylib'
其实这里是有两个问题:dyld: Library not loaded: @rpath/libswiftCore.dylib 和 Reason: no suitable image found. Did find:
如果是一起出现的话,更有可能是第一个问题导致了第二个问题,你可以先尝试先把:
Build Settings -> Build Options -> "Embedded Content Contains Swift Code" 设为YES即可,默认是NO,然后清理重新运行,如果还未解决,再试下下面这个方法:如果是单独出现第二个问题,则第一个方法就不用试了。
是因为你的开发证书被掉销了过,处理方法:把手机里的app删除再把xcode 》widows 》projects里面相应的安装包也删除了,注意删除的时候需要把相应的工程从xcode中关闭,再重新打开工程,运行>>OK了
Your build settings specify a provisioning profile with the UUID, no provisioning profile was
在Archive项目时,出现了“Your build settings specify a provisioning profile with the UUID “”, however, no such provisioning profile was found”的出错。一直提示指定UUID的provisioning profile找不到,感觉很奇怪。明明自己的provisioning profile是刚下载好的,并且全是新安装。于是通过谷歌找到了答案。
参考地址:http://stackoverflow.com/questions/1760518/codesign-error-provisioning-profile-cannot-be-found-after-deleting-expired-prof
这里所说的就是要通过修改你的项目的.xcodeproj文件来解决上述的错误。
1.找到项目中的**.xcodeproj文件,点击右键,show package contents(打开包内容)。
2.打开后找到project.pbxproj文件,用文本编辑器打开。其实就是右键,点击open就好了。
3.打开这个文件后,按command+F,在这个文件中查找“PROVISIONING_PROFILE",找到和这个“
PROVISIONING_PROFILE = "487F3EAC-05FB-4A2A-9EA0-31F1F35760EB"; "PROVISIONING_PROFILE[sdk=iphoneos*]" = "487F3EAC-05FB-4A2A-9EA0-31F1F35760EB";
”类似的都删除。
4.然后保存文件,重新打开项目。xcode会提示你重新下载安装provisioning profile文件。下载后安装上就可以。
ps:我在xcode5中,是它自己通过网络安装的。
iOS QQ实现第三方登录以及遇到的问题
过程中遇到的问题
1. l_OBJC_PROTOCOL_$_TencentApiInterfaceDelegate", referenced from: 和 linker command failed with exit code 1 (use -v to see invocation)
这个问题重点还是在 <TencentSessionDelegate> 这代理的警告: Cannot find protocol definition for 'TencentsessionDelegate'
这种明明都能运行还说我没有定义的警告,是因为你这个协议虽然定义了,但是你这个协议可能还遵守了XX协议,然后这个XX协议没有定义导致会报这种警告,所以遇到这种警告要往“父协议”找。 举个栗子,上面这行就是腾讯授权的库里面报的警告
注: 解决办法 :此协议遵守了TencentApiInterfaceDelegate协议,在TencentOAuth.h类中#import "TencentApiInterface.h" 警告就没有了
现在就应该可以运行了
2.如果你的输出信息是 xxxx - error: "This app is not allowed to query for scheme xxxx"
(在这里因为我的 App 集成了分享到QQ、微信、微博的功能,xxxx部分我看到了 mqq、wechat、sinaweibosso 等多条信息)
解决办法: 去 Info.plist 里面建立一个叫 LSApplicationQueriesSchemes 的 Array,把你在xxxx部分看到的词汇一个一个填进去,直至控制台没有任何相关输出即可。
4.项目运行报错如下
<Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
<Error>: CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
<Error>: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
出错原因:设置app的状态栏样式的使用使用了旧的方式,在info.plist里面设置了View controller-based status bar appearance为NO,默认为YES,一般式iOS6的时候使用这种方式,iOS7,8也兼容,但是到了iOS9就报了警告。
[[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleLightContent];
以前我们通过上面代码改变状态了颜色,iOS9以后点进去看api发现如下说明
// Setting the statusBarStyle does nothing if your application is using the default UIViewController-based status bar system. @property(readwrite, nonatomic) UIStatusBarStyle statusBarStyle NS_DEPRECATED_IOS(2_0, 9_0, "Use -[UIViewController preferredStatusBarStyle]"); - (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyle animated:(BOOL)animated NS_DEPRECATED_IOS(2_0, 9_0, "Use -[UIViewController preferredStatusBarStyle]");
解决办法:
修改方式将View controller-based status bar appearance设置为YES,然后使用新的方式来实现状态栏的样式。
- (UIStatusBarStyle)preferredStatusBarStyle; - (UIViewController *)childViewControllerForStatusBarStyle; - (void)setNeedsStatusBarAppearanceUpdate
2015.09.21更新
5 directory not found for option问题
警告如下:
ld: warning: directory not found for option '-F/Applications/Xcode 7.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/Developer/Library/Frameworks'
问题原因:Xcode7将framworks位置改变了。
解决方法:
点击项目,选择 Targets->xxxTests
选择build setting ,找到 Frameworks Search Path 或者 Library Search Paths
删除$(SDKROOT)/Developer/Library/Frameworks,
或者使用$(PLATFORM_DIR)/Developer/Library/Frameworks替换
framworks位置改变
造成unrecognized selector sent to instance iphone,大部分情况下是因为对象被提前release了,在你心里不希望他release的情况下,指针还在,对象已经不在了。