小编And*_*nov的帖子

为CocoaPods的pod设置部署目标

我使用CocoaPods来管理项目中的依赖项.我写过Podfile:

target 'MyApp' do
  platform :ios, '8.0'
  # Uncomment this line if you're using Swift or would like to use dynamic frameworks
  #use_frameworks!

  # Pods for MyApp
  pod 'KeepLayout', :git => 'https://github.com/iMartinKiss/KeepLayout', :tag => 'v1.6.0'
  pod 'EasyMapping'

  target 'MyAppTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'MyAppUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end
Run Code Online (Sandbox Code Playgroud)

这个文件适用于CocoaPods 0.x,但是在我更新到CocoaPods 1.0后我无法编译项目.我跑完之后

pod update 
Run Code Online (Sandbox Code Playgroud)

我无法编译我的项目错误:

/Users/<...>/Pods/KeepLayout/Sources/KeepAttribute.m:195:1:无法合成弱属性,因为当前部署目标不支持弱引用

我已经看到每个库都使用不同的部署目标进行构建.例如,使用4.3部署目标构建KeepLayout.

我如何确定每个pod依赖项的构建目标?

xcode ios cocoapods xcode7

43
推荐指数
6
解决办法
2万
查看次数

附加视频的自定义缩略图(不提取) - IOS,AVFoundation

我使用AVFoundation生成视频.之后,我使用Photos Framework将视频写入照片库(之后获取PHAsset的实例).

我想为添加的PHAsset(视频的最后一帧)设置自定义缩略图,但无法找到解决方案.如何为添加的视频添加自定义缩略图?我想在我打开时在照片应用程序中看到我的自定义缩略图.

此外,我知道如何使用视频从视频中获取一些图像AVAssetImageGenerator,但我想在照片应用程序中看到我的缩略图.

video thumbnails avfoundation ios photosframework

14
推荐指数
1
解决办法
1186
查看次数

Xcode 7在创建新文件时崩溃

我有"El Capitan GM",我已将Xcode更新为Xcode 7 GM.现在我无法创建新的类,Xcode崩溃与消息:

UNCAUGHT EXCEPTION (NSInvalidArgumentException): -[NSOpenPanel setAccessoryViewDisclosed:]: unrecognized selector sent to instance 0x7f940cf89af0
Run Code Online (Sandbox Code Playgroud)

有人遇到过这个问题吗?有人解决了吗?

UPD

现在我正在使用AppCode创建新文件和Xcode来编写代码.

objective-c xcode7 osx-elcapitan

5
推荐指数
1
解决办法
1606
查看次数

指针在自动生成的 ModuleName-Swift.h 文件中缺少可空性类型说明符

我有一个带有 swift 和 ObjC 源的项目,并且在自动生成的头文件中有一条奇怪的消息:

在此处输入图片说明

标有错误的代码:

//interface in ModuleName-Swift.h  file
@interface PointsList : NSObject
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
- (nonnull instancetype)initWithPoints:(NSArray<NSValue *> * /*this marked with warning*/_Nonnull)points OBJC_DESIGNATED_INITIALIZER; //Warning:Pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)
- (nonnull instancetype)initWithValues:(NSArray<NSValue *> * /*this marked with warning*/_Nonnull)pointValues //Warning:Pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)
@end



//source PointsList.swift
   @objc public class PointsList : NSObject {

    var points = Array<CGPoint>()
    @objc public override init() {
        super.init()
    } …
Run Code Online (Sandbox Code Playgroud)

xcode objective-c swift

5
推荐指数
1
解决办法
674
查看次数

使用 KVO_IS_RETAINING_ALL_OBSERVERS_OF_THIS_OBJECTS_IF_IT_CRASHES_AN_OBSERVER_WAS_OVERRELEASED_OR_SMASHED 创建时 NSProgress 崩溃

我使用 NSProgress 来通知复杂任务的进度(该任务由许多子任务组成,可以由其他子任务组成)。
我在 startTask 方法中创建主要进度:

- (void)_startTask
{
    _progress = [NSProgress progressWithTotalUnitCount:100]; //sometimes crash is here
    <...>
}
Run Code Online (Sandbox Code Playgroud)

没有当前进度:

(lldb) po [NSProgress currentProgress]
nil

有时我会因为奇怪的 stackTrace 崩溃:

0:0x000000018539a7e8在object_isClass()
1:0x0000000186b39fe0在KVO_IS_RETAINING_ALL_OBSERVERS_OF_THIS_OBJECT_IF_IT_CRASHES_AN_OBSERVER_WAS_OVERRELEASED_OR_SMASHED()
2:0x0000000186b384bc在
NSKeyValueWillChangeWithPerThreadPendingNotifications()
3:0x0000000186cac9c0在- [NSProgress _setValueForKeys:settingBlock:]()
4:0x0000000186cacc7c在- [NSProgress setTotalUnitCount:]()
5:0x0000000186cab718在 +[NSProgress progressWithTotalUnitCount:] ()

此代码在 mainThread 中执行。
为什么会发生这种情况,我可以做些什么来避免这种情况?

ios nsprogress

4
推荐指数
1
解决办法
1603
查看次数

为什么基于 OpenGL 的 iOS 应用程序会在审核过程中被拒绝?

我试图找到一个文档的链接,其中 Apple 写道,所有新应用程序都不能基于 OpenGL。
我知道 OpenGL 已被弃用。
有人可以展示一些文档,其中写着我无法使用 OpenGL ES 发布新应用程序(所有使用 OpenGL 的新应用程序都将被拒绝)吗?
我需要一个文档的链接,而不是关于拒绝某些 OpenGL 应用程序的故事。

opengl-es app-store ios metal

1
推荐指数
1
解决办法
922
查看次数