小编Kev*_*ado的帖子

如何在Xcode 9上运行多个模拟器?

根据Xcode上的新功能,Xcode 9允许我们运行多个模拟器实例.

但是这样做的方法是什么?

我试着Build & Run在不同的模型上,但它Quit是当前的实例.

xcode ios-simulator

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

将Google Analytics添加到iOS应用程序会导致错误

我添加了GAI框架.

档案:

- GAI.h - GAIDictionaryBuilder.h - GAIFields.h GAILogger.h - GAITrackedViewController.h - GAITracker.h - libGoogleAnalytics_debug.a

但是,当我尝试构建项目时,它显示了这样的错误:

Undefined symbols for architecture i386:
  "_llvm_gcda_emit_arcs", referenced from:
      ___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAI.o)
      ___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIUncaughtExceptionHandler.o)
      ___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIBatchingDispatcher.o)
      ___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIDataStore.o)
      ___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIDefaultLogger.o)
      ___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIStringUtil.o)
      ___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAITrackerImpl.o)
      ...

"_llvm_gcda_emit_function", referenced from:
      ___llvm_gcov_writeout in ...

"_llvm_gcda_end_file", referenced from:
      ___llvm_gcov_writeout in ...

"_llvm_gcda_increment_indirect_counter", referenced from:
      -[GAI defaultTracker] in libGoogleAnalytics_debug.a(GAI.o)
      -[GAI setDefaultTracker:] in libGoogleAnalytics_debug.a(GAI.o)
      ...

"_llvm_gcda_start_file", referenced from:
      ___llvm_gcov_writeout in ...
Run Code Online (Sandbox Code Playgroud)

ld:找不到架构i386 clang的符号:错误:链接器命令失败,退出代码为1(使用-v查看调用) …

google-analytics ios

9
推荐指数
3
解决办法
7792
查看次数

错误ITMS-90206无效捆绑包含不允许的文件'框架'

我通过Xcode将我的应用程序上传到商店时遇到问题,特别是这个问题.

无效的Bundle包含不允许的文件框架

我看到很多关于这个错误的帖子,但所有人都在谈论Extension App,我不使用.

我正在使用Custom frameworkCocoapods.

你可以在这里看到我的树:

Tree Xcode项目自定义框架

  • XXX是我的项目应用名称
  • SharedXXX是我的custom framework
  • Pods是由.创建的项目cocoa pods

这是我的可可podFile:

use_frameworks!
link_with 'XXX', 'SharedXXX'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'


workspace 'XXX'

xcodeproj 'XXX/XXX.xcodeproj'
xcodeproj 'Shared/SharedXXX.xcodeproj'

def default_pods
    pod 'Reveal-iOS-SDK', :configurations => ['Debug']
    pod "SnapKit", '~> 0.17.0'
    pod "DKChainableAnimationKit", '~> 1.6.0'
    pod "AsyncSwift"
end

def shared_pods
    pod "Alamofire", '~> 3.0'
    pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
    pod 'ReachabilitySwift', :git => 'https://github.com/ashleymills/Reachability.swift'
end

target :XXX do
    xcodeproj 'XXX/XXX.xcodeproj' …
Run Code Online (Sandbox Code Playgroud)

xcode ios ios-frameworks cocoapods swift-custom-framework

9
推荐指数
2
解决办法
8662
查看次数

如何在Swift中调用协议提供的静态方法

如何访问static实例中的协议方法

我有一个列表Contact,联系人可以是一个FamilyContact继承ContactGroupStatus protocol

我想调用静态方法,GroupStatus但是徒劳无功......

这是我的代码

protocol GroupStatus {
    static func isPrivate() -> Bool // static method that indicates the status
}

protocol IsBusy {
    func wizzIt()
}

class AdresseBook {

    private var contacts = [Contact]()

    func addOne(c: Contact) {
        contacts.append(c)
    }

    func listNonPrivated() -> [Contact]? {

        var nonPrivateContact = [Contact]()

        for contact in contacts {
            // here is I should call the static method provided by the protocol
            if …
Run Code Online (Sandbox Code Playgroud)

static protocols ios swift

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

Quicklook/QLPreviewController,iOS 8的一些问题,但一切都适用于iOS 7.1

我正在使用QuickLook查看PDF文件.

它在iOS 7.1中正常工作,但iOS 8 GM会出现一些问题.

图片比文字好,我想告诉你问题:

iOS 7.1 Xcode 6(工作正常)

使用QuickLook进行转换(没有失败)

Transition QuickLook iOS 7.1

页面滚动,navigationBar隐藏得很好

页面滚动QuickLook iOS 7.1

-------------------------------------------------- ------------------------

而现在,iOS 8 GM与Xcode 6

使用QuickLook进行过渡...

Transition QuickLook iOS 8 GM

页面滚动,navigationBar不隐藏,页面指示器隐藏在NavigationBar后面

页面滚动QuickLook iOS 8 GM

与iPhone模拟器,iPad模拟器,iPhone设备和iPad设备相同的问题.

你可以在这里看到我的源代码:

- (NSInteger)numberOfPreviewItemsInPreviewController:(QLPreviewController *)previewController
{
    NSInteger numToPreview = 0;
    if (currentSection == CVSectionConvocations)
        numToPreview = self.convocation.convocations.count;
    else if (currentSection == CVSectionAttachments)
        numToPreview = self.convocation.attachements.count;
    return numToPreview;
}

- (id)previewController:(QLPreviewController *)previewController previewItemAtIndex:(NSInteger)idx
{
    PDF *pdf;
    if (currentSection == CVSectionConvocations)
        pdf = self.convocation.convocations[idx];
    else if (currentSection == CVSectionAttachments)
        pdf = self.convocation.attachements[idx];
    return [pdf path];
}



- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { …
Run Code Online (Sandbox Code Playgroud)

objective-c quicklook ios

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

使用自定义UICollectionViewLayout'没有UICollectionViewLayoutAttributes -layoutAttributesForItemAtIndexPath实例'错误

我正在使用这样的自定义UICollectionViewLayout:

override func prepareLayout() {
        cache.removeAll(keepCapacity: false)

        let standardHeight = LayoutConstants.Cell.standardHeight
        let featuredHeight = LayoutConstants.Cell.featuredHeight

        var frame = CGRectZero
        var y: CGFloat = 0

        for item in 0..<numberOfItems {
            let indexPath = NSIndexPath(forItem: item, inSection: 0)
            let attributes = UICollectionViewLayoutAttributes(forCellWithIndexPath: indexPath)
            let cell = collectionView!.cellForItemAtIndexPath(indexPath)
            /* Important because each cell has to slide over the top of the previous one */
            attributes.zIndex = item
            /* Initially set the height of the cell to the standard height */
            var height = …
Run Code Online (Sandbox Code Playgroud)

ios uicollectionview uicollectionviewlayout swift

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

Symfony2上的FOS\RestBundle,"无法识别的选项"

我有一个Symfony2创建Rest API和使用的问题FOS\RestBundle

当我尝试生成数据库或实体时......无论我尝试生成什么,都会发生错误.

root@symfonyRest:/var/www/Symfony# php5 app/console doctrine:database:create



  [Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]  
  Unrecognized options "prefer_extension" under "fos_rest.format_listener"  
Run Code Online (Sandbox Code Playgroud)

问题似乎在于 config.yml

config.yml

imports:
    - { resource: parameters.yml }
    - { resource: security.yml }

framework:
    #esi:             ~
    #translator:      { fallback: %locale% }
    secret:          %secret%
    router:
        resource: "%kernel.root_dir%/config/routing.yml"
        strict_requirements: ~
    form:            ~
    csrf_protection: ~
    validation:      { enable_annotations: true }
    templating:
        engines: ['twig']
[…]

sensio_framework_extra:
    view:    { annotations: false }
    router:  { annotations: true }

fos_rest:
    format_listener:
        prefer_extension:       false
    view:
        view_response_listener: true
Run Code Online (Sandbox Code Playgroud)

编辑:

新 …

symfony fosrestbundle

5
推荐指数
2
解决办法
8195
查看次数

使用Swift获取网站数据

我试图使用a NSURLSession从espn中提取一些数据,但我似乎无法让它工作.它只打印nil.

我已经在他们的网站上用另一个页面测试了这个方法并且它有效,但我无法使用代码中的那个.这是有问题的代码:

var url = NSURL(string: "http://espn.go.com/golf/leaderboard?tournamentId=2271")

if url != nil {

    let task = NSURLSession.sharedSession().dataTaskWithURL(url!, completionHandler: { (data, response, error) -> Void in

        print(data)

        if error == nil {

            var urlContent = NSString(data: data, encoding: NSUTF8StringEncoding) as NSString!

            print(urlContent)
Run Code Online (Sandbox Code Playgroud)

我也尝试过更改无法正常工作的编码类型.它打印的数据看起来像是UTF 8格式,所以我认为这不会起作用,但觉得我应该尝试.

我觉得我的想法已经用完了.

编辑:应该指定更多,print(data)打印出我期望的,编码数据,但print(urlContent)打印nil.

web-scraping ios nsurlsession swift

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

CATransformLayer:在仅变换图层中更改属性masksToBounds将不起作用

我正在使用Xcode 7和swift 2.

在我的iPad Air,iOS 9.1上,当键盘出现时,调试控制台上会出现错误

2015-10-28 13:07:35.114 Note[73896:6954126] <CATransformLayer: 0x7a2dc070> - changing property masksToBounds in transform-only layer, will have no effect
2015-10-28 13:07:35.115 Note[73896:6954126] <CATransformLayer: 0x7a2dd090> - changing property masksToBounds in transform-only layer, will have no effect
2015-10-28 13:07:35.115 Note[73896:6954126] <CATransformLayer: 0x7a035df0> - changing property masksToBounds in transform-only layer, will have no effect
Run Code Online (Sandbox Code Playgroud)

这是Apple的错误吗?

编辑:

这似乎是Applen的一个错误,任何人都单独解决了它?

xcode ios

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

如何在iOS中保存本地PDF或其他文件

我正在开发功能来阅读PDF并在iPhone和iPad上本地保存.我正在构建iOS 6.1及更多,所以我对SDK没有任何约束.

所以,我想知道在本地(无论文件)写内容的最佳和简单的解决方案是什么.

也许有人知道一个lib来做这个功能?

pdf objective-c save ios

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

如何在 Swift 中从 macOS 应用程序运行 git 命令?

我想运行 git 命令,然后从 macOS 应用程序启动 Xcode。

但我目前在第一步上被阻止:运行 git 命令

我使用 尝试了很多代码ProcessNSWorkspace.shared.openApplication但仍然被阻止。你可以在这里看到我的最后一次尝试。

@discardableResult
func shell(_ app: String, _ args: String...) -> Int32 {
    let task = Process()
    task.launchPath = "/usr/bin/\(app)"
    task.arguments = args
    task.launch()
    task.waitUntilExit()
    return task.terminationStatus
}

shell("git", "clone https://github.com/user/repo.git")
Run Code Online (Sandbox Code Playgroud)

但会抛出错误:

git: 'clone https://github.com/user/repo.git ' 不是 git 命令。请参阅“git --help”。

难道我错了?这是正确的做法吗?我需要授予权限或类似的东西吗?

git macos shell swift

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