小编rez*_*a23的帖子

iCloud和GEOResourceManifestServerRemoteProxy:丢失与geod警告的连接

我正在测试我使用的应用程序iCloud.有时,当我启动应用程序时,我在控制台中收到以下警告:

GEOResourceManifestServerRemoteProxy: Lost connection to geod
Run Code Online (Sandbox Code Playgroud)

一旦我收到此警告,我似乎无法获得任何数据iCloud.我试过搜索这个问题,但发现的信息很少.

有关如何尝试检测此问题并尝试处理它的任何建议?

iphone warnings ios icloud

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

更改数组中struct的值

我想将结构存储在数组中,访问并更改for循环中结构的值.

struct testing {
    var value:Int
}

var test1 = testing(value: 6 )

test1.value = 2
// this works with no issue

var test2 = testing(value: 12 )

var testings = [ test1, test2 ]

for test in testings{
    test.value = 3
// here I get the error:"Can not assign to 'value' in 'test'"
}
Run Code Online (Sandbox Code Playgroud)

如果我将结构更改为类它可以工作.任何人都可以告诉我如何更改结构的值.

arrays struct swift

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

UIView transitionWithView swift语法

有些人可以帮助我在swift中使用transitionWithView的语法.在objective-c中我会像这样使用它:

[UIView transitionWithView:[ self view ] duration:0.325 options:UIViewAnimationOptionCurveEaseOut animations:
 ^{
     // do the transition
 }
 completion:
 ^( BOOL finished ){
    // cleanup after the transition
 }];
Run Code Online (Sandbox Code Playgroud)

但是我无法让完成处理程序工作.谢谢

uiview ios swift

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

访问Swift中Objective-c .m文件中定义的全局const CGFloat

我已经在我的.m文件中定义了一些常量,我需要从我的swift代码中访问它.它们被定义为:

const CGFloat testValue = 40.0;
Run Code Online (Sandbox Code Playgroud)

在我的其他objective-c .m文件中,我可以使用extern以下方法访问它们:

extern const CGFloat testValue
Run Code Online (Sandbox Code Playgroud)

是否有一种等效的方法可以从.swift文件中访问这些常量?

constants cgfloat ios swift xcode6

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

CGGradient问题与swift 3

只是在将我的代码从swift 2.3转换为3的过程中.在旧代码中,我通过以下代码创建了一个渐变:

        let colours:CFArrayRef = [tColour.CGColor, bColour.CGColor]
        let colorSpace = CGColorSpaceCreateDeviceRGB()
        let gradient = CGGradientCreateWithColors(colorSpace, colours, nil)
Run Code Online (Sandbox Code Playgroud)

当Xcode 8转换代码时,它将其更改为以下内容:

    let colours:CFArray = [tColour.cgColor, bColour.cgColor]
    let colorSpace = CGColorSpaceCreateDeviceRGB()
    let gradient = CGGradient(colorsSpace: colorSpace, colors: colours, locations: nil)
Run Code Online (Sandbox Code Playgroud)

但是,代码会产生以下错误:

上下文类型"CFArray"不能与数组文字一起使用

任何人都可以建议如何正确转换代码.
感谢
Reza

swift3 ios10 xcode8

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

在开发期间重复requestAccessToEntityType:EKEntityTypeEvent的过程

我正在开发一个需要访问日历数据库的应用程序.我输入了一个代码,现在要求我在网站上找到的许可,并且谢谢你:

requestAccessToEntity iOS6-向后兼容性 - EKEventStore

但是出于测试目的,我希望能够停用该权限并重新运行该应用程序,以便再次询问该问题.如果我从设备中删除应用程序并重新安装它,设备会记住该权限已被询问,并且不会再次询问.如果我再次关闭权限,则不会再次询问权限,但显然无法访问权限.那么如何让设备完全忘记它已经安装了应用程序.谢谢

雷扎

events calendar ekeventkit ios6

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

将NSArray的内容添加到Swift Array

我在我的应用程序中使用swift和objective-c.

我有一个CustomClass,我想为类创建一个swift数组,并从我的Objective-c类中添加内容,该类名为oldClass,在NSArray中有一个名为arrayOfCustomClass的这些对象的数组.

var newArray = [CustomClass]()
newArray += oldClass.arrayOfCustomClass
Run Code Online (Sandbox Code Playgroud)

这会导致错误:

'[(CustomClass)]' is not identical to 'CGFloat'
Run Code Online (Sandbox Code Playgroud)

有帮助吗?谢谢Reza

objective-c swift

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

swift 3和CGContextEOClip

当我将我的代码转换为swift 3时,我收到了这个错误:

error: 'CGContextEOClip' is unavailable: Use clip(using:)
                                CGContextEOClip(context!);
                                ^~~~~~~~~~~~~~~
CoreGraphics.CGContextEOClip:2:13: note: 'CGContextEOClip' has been explicitly marked unavailable here
public func CGContextEOClip(_ c: CGContext?)
Run Code Online (Sandbox Code Playgroud)

我不知道如何使用剪辑(使用:),我没有看到任何与它相关的文档.有任何想法吗.谢谢Reza

swift3 ios10

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

EKCalendar和错误域= NSMachErrorDomain代码= 268435459

我正在探索EKEventKit.我连接我的iPhone并拨打电话以安装日历

EKEventStore *eventDB = [[EKEventStore alloc] init];
NSArray * calendars = [eventDB calendars ];
Run Code Online (Sandbox Code Playgroud)

但是,当我记录日历时,我收到此错误消息

"CADObjectGetIntProperty失败,错误错误Domain = NSMachErrorDomain Code = 268435459"操作无法完成.(Mach error 268435459 - (ipc/send)invalid destination port)"

有谁知道这是什么,为什么我得到它.谢谢

雷扎

calendar ios ekeventkit

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

iOS 共享扩展中的 SUBQUERY 排除文件类型

我的共享扩展有以下 NSExtensionActivationRule,它允许我的应用程序与图像和 pdf 文件交互:

SUBQUERY (
    extensionItems, $extensionItem,
    SUBQUERY (
        $extensionItem.attachments, $attachment,
        ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.adobe.pdf" ||
        ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image" ||
        ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url"
    ).@count == 1
).@count > 0
Run Code Online (Sandbox Code Playgroud)

但是,当我使用不同的方法访问我自己的文件时,我需要不为我的应用程序文档类型的文件显示我的应用程序com.myApp.extension
是否有任何改进:

ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url

以便排除特定类型的文件。

感谢

typeid ios

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

取消iOS中的App购买

我正在沙盒环境中测试我的应用内购买.当我开始"restoreCompletedTransactions"的过程时,我得到了对话框,要求我输入测试用户的密码.如果在那个阶段我只是按取消我没有得到任何反馈,该过程已被取消.

有什么建议

雷扎

iphone in-app-purchase ios

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

在ImageContext中创建UIImage进行自动发布

我正在自动释放池内部绘制ImageContext来控制内存占用,并从自动释放池内部返回图像。我在此调用中崩溃,我想知道它是否是由调用函数使用该映像之前在自动释放池中释放该映像引起的。这是我的代码:

-( UIImage *)   imageRepFromShapes
{
    CGRect sheetDisplayView = [ UIScreen mainScreen ].bounds;


    @autoreleasepool {

        UIGraphicsBeginImageContextWithOptions( boundingRect_m.size, NO, 0.0 );

        CGContextRef context = UIGraphicsGetCurrentContext();
        UIGraphicsPushContext(context);
        for ( Shape *shape in arryOfShapes ) {
            [ shape drawShape ];
        }
        UIGraphicsPopContext();

        UIImage     *image = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
        return image;
    }
}
Run Code Online (Sandbox Code Playgroud)

另一个问题是我是否需要在此调用中使用UIGraphicsPushContext和UIGraphicsPopContext并将它们放置在正确的位置。我希望澄清这一点。谢谢你

雷扎

objective-c uiimage ios

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