小编Jan*_*aya的帖子

如何按字母顺序对NSArray进行排序?

如何[UIFont familyNames]按字母顺序对填充的数组进行排序?

sorting objective-c

374
推荐指数
5
解决办法
22万
查看次数

[Facebook-iOS-SDK 4.0]如何从FBSDKProfile获取用户电子邮件地址

我正在将我的应用程序升级到Facebook-iOS-SDK-4.0,但似乎我无法收到用户的电子邮件FBSDKProfile,因为它只提供,用户名,用户ID等.

objective-c facebook-ios-sdk facebook-ios-sdk-4.0

45
推荐指数
4
解决办法
4万
查看次数

Swift中的__block

__block变量上的关键字Objective C用于确保将特别处理此变量block,但与此关键字的对应关系是swift什么?

我做了一些谷歌研究,但到目前为止一切都让我困惑.

以下是我的代码:

var myArr = NSMutableArray()
completionBlock(myArray,nil)
Run Code Online (Sandbox Code Playgroud)

我试过了

__block var myArr = NSMutableArray()
Run Code Online (Sandbox Code Playgroud)

ios swift

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

如何使用appStoreReceiptURL

transactionReceipt已弃用.但我无法使用,

[[NSBundle mainBundle] appStoreReceiptURL].
Run Code Online (Sandbox Code Playgroud)

如果有收据,这应该返回收据的URL.但对我来说没有一个,因为这个值是零,而且据我所知,它不应该是.我在iOS 7上运行并且已经完成了一些应用内购买(设备上的沙箱).

谁能帮忙.

objective-c in-app-purchase ios skpaymenttransaction

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

在Swift 3中启用核心数据轻量级迁移

根据我读过的文章,启用核心数据轻量级迁移的正确方法是将选项传递给addPersistentStoreWithType:

let mOptions = [NSMigratePersistentStoresAutomaticallyOption: true,
NSInferMappingModelAutomaticallyOption: true]

try coordinator!.addPersistentStoreWithType(
NSSQLiteStoreType, configuration: nil, URL: url, options: mOptions)
Run Code Online (Sandbox Code Playgroud)

但在我的Xcode 8 Swift 3项目中,我无法找到addPersistentStoreWithType所谓的地方.这是core data我创建项目时生成的唯一代码:

 // MARK: - Core Data stack

lazy var persistentContainer: NSPersistentContainer = {
    /*
     The persistent container for the application. This implementation
     creates and returns a container, having loaded the store for the
     application to it. This property is optional since there are legitimate
     error conditions that could cause the creation …
Run Code Online (Sandbox Code Playgroud)

xcode core-data ios swift swift3

16
推荐指数
5
解决办法
7153
查看次数

如何在UIButton中调整文本的字体大小以在Swift中以编程方式适应宽度?

我试图以UIButton编程方式设置文本,但文本在按钮中显示时会缩写.有没有办法通过代码调整按钮中文本的字体大小以适应宽度?我已经检查了其他问题,但答案并没有解决我的问题.谢谢.

resize uibutton ios swift xcode6

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

Swift 3中对成员'下标'的模糊引用

我有一个用Swift 1.5构建的项目.当我将代码转换为swift 3.0时,它开始在下面的代码中的每个'if'语句中显示错误:

convenience init?(userInfo: [NSObject: AnyObject]) {
    guard let statusString = userInfo[ConnectionMessage.StatusKey] as? String else {
        return nil
    }
    guard let status = ConnectionStatus(string: statusString) else {
        return nil
    }

    guard let connectionId = userInfo[ConnectionMessage.ConnectionIdKey]?.longLongValue else {
        return nil
    }

    var ssid = ""

    if let newSsid = userInfo[ConnectionMessage.SSIDKey] as? String {
        ssid = newSsid
    }

    var password = ""
    if let pw = userInfo[ConnectionMessage.PasswordKey] as? String {
        password = pw
    }

    let buyerName = userInfo[ConnectionMessage.BuyerNameKey] as? String

    self.init(status: …
Run Code Online (Sandbox Code Playgroud)

dictionary ios swift3 xcode8

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

iTunes Connect:无效的二进制文件

我在iTunes Connect.

我有一个应用程序,我对此进行了一些更改。所以现在我正在使用 Organizer 上传更新版本,但上传后,我收到“ invalid binary”,但没有更多信息。查看这个论坛,我发现很多人都面临同样的问题,但没有解决方案适合我。

我在上传之前验证了应用程序,验证过程没问题..欢迎任何建议,这让我发疯。

提前致谢。

Titanium SDK 5.5.0 遗传算法

macOS Sierra.

appcelerator ios app-store-connect

8
推荐指数
3
解决办法
1万
查看次数

由于缺少 Info.plist,xcarchive 格式错误

我有两个基于相同 Rake 脚本构建的项目,该脚本在内部使用 XCode 构建。用xcodebuild -archivePath(ARCHIVE 成功)构建它,然后我用xcodebuild -exportArchive. 问题是第一个项目所有步骤都成功,但第二个项目xcodebuild -exportArchive由于xcarchive格式错误而失败。我比较了这两个档案,畸形是由于档案Info.plist内部丢失造成的。当我手动准备此类Info.plist并将其放入 时xcarchive,我就可以毫无问题地打包应用程序。

为什么 XCode 构建不会产生Info.plist内部xcarchive文件的任何线索?

xcodebuild ios xcarchive xcode8

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

如何在运行会话期间更改AVCaptureMovieFileOutput视频方向?

我已经制作了一个捕获设备视频输入的代码,到目前为止它工作正常.这是我设定的

// add preview layer
_previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:_session];
_previewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
[self.videoView.layer addSublayer:_previewLayer];

// add movie output
_movieFileOutput = [[AVCaptureMovieFileOutput alloc] init];
[_session addOutput:_movieFileOutput];
AVCaptureConnection *movieFileOutputConnection = [_movieFileOutput connectionWithMediaType:AVMediaTypeVideo];
movieFileOutputConnection.videoOrientation = [self videoOrientationFromCurrentDeviceOrientation];

// start session
[_session startRunning];
Run Code Online (Sandbox Code Playgroud)

哪里:

- (AVCaptureVideoOrientation) videoOrientationFromCurrentDeviceOrientation {
    switch ([[UIApplication sharedApplication] statusBarOrientation]) {
        case UIInterfaceOrientationPortrait: {
            return AVCaptureVideoOrientationPortrait;
        }
        case UIInterfaceOrientationLandscapeLeft: {
            return AVCaptureVideoOrientationLandscapeLeft;
        }
        case UIInterfaceOrientationLandscapeRight: {
            return AVCaptureVideoOrientationLandscapeRight;
        }
        case UIInterfaceOrientationPortraitUpsideDown: {
            return AVCaptureVideoOrientationPortraitUpsideDown;
        }
        case UIInterfaceOrientationUnknown: {
            return 0;
        }
    } …
Run Code Online (Sandbox Code Playgroud)

iphone video avfoundation ios

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