小编Eri*_*ric的帖子

在应用程序购买之后,应用程序在启动时崩溃.产品识别=无?

我有一些用户报告说,在尝试购买应用程序后,该应用程序现在在启动时崩溃.我已要求他们删除并重新安装尚未运行的应用程序,并试图让他们进入飞行模式以停止任何无效的网络通信.

我无法在我的设备上复制错误,我的应用程序购买在沙箱和生产模式中完成得很好.我的想法是,他们的事务以某种方式收到了一个nil productIdentifier,导致启动崩溃,但我不确定在app启动时调用哪些事务观察器方法,我可以为他们解决问题.

有没有办法"清除"事务队列或在启动时测试nil productidentifier并允许这些用户至少再次运行应用程序?我已经使用下面的代码完成了几百个应用内购买,而这最近刚开始发生.在app启动时调用哪个辅助方法?

在AppDelegate.m中

[[SKPaymentQueue defaultQueue] addTransactionObserver:[MovieClockIAPHelper sharedHelper]];
Run Code Online (Sandbox Code Playgroud)

在app帮助程序代码中:

- (id)initWithProductIdentifiers:(NSSet *)productIdentifiers {
    if ((self = [super init])) {

        // Store product identifiers
        _productIdentifiers = [productIdentifiers retain];

        // Check for previously purchased products

        NSMutableSet * purchasedProducts = [NSMutableSet set];
        for (NSString * productIdentifier in _productIdentifiers) {

            BOOL productPurchased = [[NSUserDefaults standardUserDefaults] boolForKey:productIdentifier];

            if (productPurchased) {
                [purchasedProducts addObject:productIdentifier];
                NSLog(@"Previously purchased: %@", productIdentifier);
            }
            else{
            NSLog(@"Not purchased: %@", productIdentifier);
            }
        }
        self.purchasedProducts = purchasedProducts;

    }
    return self;
}

- (void)requestProducts …
Run Code Online (Sandbox Code Playgroud)

null storekit in-app-purchase ios

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

将UIImage转换为CVImageBufferRef

这段代码大部分都有效,但结果数据似乎松散了一个颜色通道(正如我所想),因为显示的结果图像数据是蓝色的!

这是代码:

UIImage* myImage=[UIImage imageNamed:@"sample1.png"];
CGImageRef imageRef=[myImage CGImage];
CVImageBufferRef pixelBuffer = [self pixelBufferFromCGImage:imageRef];
Run Code Online (Sandbox Code Playgroud)

方法pixelBufferFromCGIImage是从stackoverflow上的另一个帖子中获取的:如何将UIImage数组导出为电影?(虽然这个应用程序与我想要做的事情无关)但确实如此

+ (CVPixelBufferRef)pixelBufferFromCGImage:(CGImageRef)image
{
    CGSize frameSize = CGSizeMake(CGImageGetWidth(image), CGImageGetHeight(image));
    NSDictionary *options = @{
                              (__bridge NSString *)kCVPixelBufferCGImageCompatibilityKey: @(NO),
                              (__bridge NSString *)kCVPixelBufferCGBitmapContextCompatibilityKey: @(NO)
                              };
    CVPixelBufferRef pixelBuffer;
    CVReturn status = CVPixelBufferCreate(kCFAllocatorDefault, frameSize.width,
                                          frameSize.height,  kCVPixelFormatType_32ARGB, (__bridge CFDictionaryRef) options,
                                          &pixelBuffer);
    if (status != kCVReturnSuccess) {
        return NULL;
    }

    CVPixelBufferLockBaseAddress(pixelBuffer, 0);
    void *data = CVPixelBufferGetBaseAddress(pixelBuffer);
    CGColorSpaceRef rgbColorSpace = CGColorSpaceCreateDeviceRGB();
    CGContextRef context = CGBitmapContextCreate(data, frameSize.width, frameSize.height,
                                                 8, CVPixelBufferGetBytesPerRow(pixelBuffer), rgbColorSpace,
                                                 (CGBitmapInfo) kCGImageAlphaNoneSkipLast);
    CGContextDrawImage(context, …
Run Code Online (Sandbox Code Playgroud)

iphone bitmap uiimage ios

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

从头开始重写iOS应用程序"无法更改应用程序的可执行权限."

我在商店有一个应用程序,我想从头开始重写整个应用程序.当我尝试在已经包含旧应用程序的设备(iPhone 4)上构建和执行新应用程序时,我收到错误:"无法更改应用程序的可执行权限."

如果我在模拟器上运行它或删除设备上的当前应用程序并安装新的可执行文件,则新的可执行文件正常工作.我担心的是升级到这个最新版本的应用程序的人将无法.

你如何处理这种情况?

xcode ios

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

通用图像加载器从黑色淡入?

我正在使用通用图像加载器从网络上"懒加载"我的图像.是否可以使用淡入淡出的动画,但淡入"从黑色"而不是"从白色"?我的应用程序有黑色背景,我希望它能顺利淡化它,而不是"闪光",因为当前效果看起来像.

这是从白色淡化的代码

  DisplayImageOptions options;
            options = new DisplayImageOptions.Builder()
            .showImageOnLoading(R.drawable.no_poster)
            .showImageForEmptyUri(R.drawable.no_poster)
            .showImageOnFail(R.drawable.no_poster)
            .displayer(new FadeInBitmapDisplayer(500))
            .cacheInMemory(true)
            .cacheOnDisc(true)
            .build();
            ImageView myPosterView = (ImageView)findViewById(R.id.movieposterlarge);
            imageLoader.displayImage(movie_poster, myPosterView,options);
Run Code Online (Sandbox Code Playgroud)

android fadein universal-image-loader

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

授权应用程序(iOS)时,Facebook连接publish_stream不再被识别

我有一个iOS应用程序,需要发布到用户的Facebook墙.直到今天(2月1日)一切正常.现在,当用户去授权应用程序时,它只询问基本权限,而不是要求发布到用户墙的能力.我发送一个publish_stream参数,但似乎它在某处"丢失"了.有任何想法吗?

facebook connect ios

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

Safari iOS7 中的 jQuery 移动幻灯片过渡动画向后滑动时跳跃

我有一个简单的链接,例如

<a href="about/staff.php" data-transition="slide">Staff</a>
Run Code Online (Sandbox Code Playgroud)

当您点击链接时,幻灯片过渡的动画效果很好,当您点击后退按钮时,幻灯片过渡的动画效果也很好。

当 safari (iOS7) 中的用户在屏幕边缘使用“滑动返回”手势时,就会出现问题。页面返回,但页面加载后动画再次出现,看起来很差。

您可以在此处的文档示例中查看问题 http://demos.jquerymobile.com/1.4.0/transitions/(点击幻灯片旁边的页面按钮,然后滑动以返回)

有解决方法吗?

safari mobile jquery transition ios7

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

在scheduledLocalNotifications数组中找到UILocalNotification而不用for循环?

目前,我循环遍历所有计划的本地通知,以根据userInfo字典对象中的值查找"匹配".当我设置了30多个本地通知时,这看起来非常慢.有没有办法在不遍历阵列的情况下访问单个本地通知?

这是我有的:

NSArray *notificationArray = [[UIApplication sharedApplication]     scheduledLocalNotifications];
UILocalNotification *row = nil;
for (row in notificationArray) {
            NSDictionary *userInfo = row.userInfo;
            NSString *identifier = [userInfo valueForKey:@"movieTitle"];
            NSDate *currentAlarmDateTime = row.fireDate;
if([identifier isEqualToString:myLookUpName]) {
 NSLog(@"Found a match!");
}
}
Run Code Online (Sandbox Code Playgroud)

这就是我想要的:

NSArray *notificationArray = [[UIApplication sharedApplication]     scheduledLocalNotifications];
UILocalNotification *row = " The row in notificationArray where [userInfo valueForKey:@"movieTitle"]=myLookUpName" ;
Run Code Online (Sandbox Code Playgroud)

ios uilocalnotification

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

gestureRecognizer shouldReceiveTouch持久存在于解除分配的视图中导致崩溃

我有一个相当简单的UITableView,它在栈上推送一个新视图.新视图有一个这样初始化的gestureRecognizer

@synthesize swipeGestureLeft;


    - (void)viewDidLoad
{
        swipeGestureLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(toggleViewLeft)];
        swipeGestureLeft.numberOfTouchesRequired = 1;
        swipeGestureLeft.delegate=self;
        swipeGestureLeft.direction = (UISwipeGestureRecognizerDirectionLeft);
        [self.view addGestureRecognizer:swipeGestureLeft];
}
Run Code Online (Sandbox Code Playgroud)

我也称为委托方法

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {

    if (viewShown==1) {
        return NO;
    }
    return YES;
}
Run Code Online (Sandbox Code Playgroud)

在我所拥有的dealloc方法中

- (void)dealloc {
    NSLog(@"I AM IN DEALLOC");


    swipeGestureLeft.delegate=nil;
    [self.view removeGestureRecognizer:swipeGestureLeft];
    swipeGestureLeft=nil;



}
Run Code Online (Sandbox Code Playgroud)

在我的.h文件中

@interface MyViewController : UIViewController <UIGestureRecognizerDelegate>
Run Code Online (Sandbox Code Playgroud)

现在,当我回到我的表视图时,视图被取消分配(我可以看到因为NSLog触发)现在当我尝试向下滑动我的表视图时,应用程序崩溃:

[MyViewController gestureRecognizer:shouldReceiveTouch:]: message sent to deallocated instance 
Run Code Online (Sandbox Code Playgroud)

如何确保在取消分配视图后不调用委托方法.

uitableview dealloc uigesturerecognizer ios

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