vendredi 14 août 2015

How Do I Unlock An In-App Purchase Item After It Has Been Purchased?

I have everything setup, and the In-App Purchase items are being saved but when the item is purchased on the MasterViewController and I return to the ViewController, the IAP item is not unlocked in a sense. If I quit the app and reopen it, the IAP item is unlocked. Thats obviously a hassle for users to have to purchase and item, close the app and reopen it for it to be unlocked.

Any help would be greatly appreciated!

Thanks



via Chebli Mohamed

AVPlayerViewController in uicollectionviewcell - cancel touch

i am having a AVPlayerViewControllerin and custom uicollectionviewcell

how can i disable the call to didSelectItemAtIndexPath when touched on the AVPlayer from AVPLayerViewController?

there are a bunch of other elements on the cell, wich should trigger the didSelectItemAtIndexPath

actually on the player controls it works, but once they fade out, another touch on the avplayer triggers the didselect.

having an uibutton in the same cell, cancels the touches correctly.



via Chebli Mohamed

AVQueuePlayer memory issue while looping a playlist in iOS

In my iOS application, I'm trying to play list of videos downloaded to applications' Documents directory. To achieve that target, I used AVQueuePlayer. Following is my code which leads to app crash after 6/7 times looping.

@interface PlayYTVideoViewController () <NSURLConnectionDataDelegate, UITableViewDataSource, UITableViewDelegate> 
{

AVQueuePlayer *avQueuePlayer;

}


- (void)playlistLoop
{
    NSLog(@"%s - %d", __PRETTY_FUNCTION__, __LINE__);

    lastPlayedVideoNumber = 0;

    _loadingVideoLabel.hidden = YES;

    avPlayerItemsMutArray = [[NSMutableArray alloc] init];

    for (NSString *videoPath in clipUrlsMutArr)
    {
        NSURL *vidPathUrl = [NSURL fileURLWithPath:videoPath];

        AVPlayerItem *avpItem = [AVPlayerItem playerItemWithURL:vidPathUrl];

        [avPlayerItemsMutArray addObject:avpItem];
    }

    avPlayerItemsArray = [avPlayerItemsMutArray copy];

    for(AVPlayerItem *item in avPlayerItemsArray)
    {
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(itemDidPlayToEndTime:) name:AVPlayerItemDidPlayToEndTimeNotification object:item];
    }

    avQueuePlayer = [AVQueuePlayer queuePlayerWithItems:avPlayerItemsArray];

    avQueuePlayer.actionAtItemEnd = AVPlayerActionAtItemEndAdvance;

    introVideoLayer = [AVPlayerLayer playerLayerWithPlayer:avQueuePlayer];

    introVideoLayer.frame = _mpIntroVideoView.bounds;

    [_mpContainerView.layer addSublayer:introVideoLayer];

    [avQueuePlayer play];
}


- (void)itemDidPlayToEndTime:(NSNotification *)notification
{
    NSLog(@"%s - %d", __PRETTY_FUNCTION__, __LINE__);

    AVPlayerItem *endedAVPlayerItem = [notification object];

    [endedAVPlayerItem seekToTime:kCMTimeZero];

    for (AVPlayerItem *item in avPlayerItemsArray)
    {
        if (item == endedAVPlayerItem)
        {
            lastPlayedVideoNumber++;
            break;
        }
    }

    [self reloadVideoClipsTable];

    if ([endedAVPlayerItem isEqual:[avPlayerItemsArray lastObject]])
    {
        [self playlistLoop];
    }
}

After getting memory issue, I tried to make some changes to above code.

I tried to set avQueuePlayer variable public and set it as strong variable

 @property (strong, nonatomic) AVQueuePlayer *avQueuePlayer;

By doing that I expected avQueuePlayer variable remain in the memory till we manually set to nil. But that didn't solve the problem.

Then I tried to set player, related arrays and layers to nil and created again for new loop session.

if (avPlayerItemsMutArray != nil)
    {
        avPlayerItemsMutArray = nil;
    }

avPlayerItemsMutArray = [[NSMutableArray alloc] init];

if (avPlayerItemsArray != nil)
    {
        avPlayerItemsArray = nil;
    }

avPlayerItemsArray = [avPlayerItemsMutArray copy];

if (avQueuePlayer != nil)
    {
        avQueuePlayer = nil;
    }

avQueuePlayer = [AVQueuePlayer queuePlayerWithItems:avPlayerItemsArray];

if(introVideoLayer != nil)
    {
        [introVideoLayer removeFromSuperlayer];
        introVideoLayer = nil;
    }

introVideoLayer = [AVPlayerLayer playerLayerWithPlayer:avQueuePlayer];

But that also didn't help to solve the issue.

Next I try to remove the observer before it re-initialized in a new loop

if (avPlayerItemsArray != nil)
{
    avPlayerItemsArray = nil;

    [[NSNotificationCenter defaultCenter] removeObserver:self
                                                    name:AVPlayerItemDidPlayToEndTimeNotification
                                                  object:nil];
}

But that also didn't help.

Next I used Instrument to find out memory usages and leaks. Application is not exceeding 18 MB when it is crashing and also there were more than 200 MB remaining as free. Instruments is little more complicated but still I didn't find any memory leaks related to this code.



via Chebli Mohamed

MailCore2 Is it possible to check which email email has been replied iphone

I am working on an iphone app which uses MailCore2 to fetch and send emails. Everything is working fine. I want to set a flag which will display that an email has been replied. Is it possible with MailCore2.

Thanks in advance.



via Chebli Mohamed

Framework CFBundleIdentifier Collision

I've made a custom SDK using Cocoa Touch Framework (followed these instructions to make it http://ift.tt/1KQdWFF) .

One app, that is using this SDK is already uploaded to app store and is reviewed by apple and all is well. Now I'm trying to submit second app to App store. All is well on the xCode, it shows that upload was completed successfully, but few minutes after uploading I get a letter that says:

CFBundleIdentifier Collision - The Info.plist CFBundleIdentifier value 'com.company.MySDK' of 'http://ift.tt/1Nd4egN' is already in use by another application.

I don’t understand why apple even checks the app framework's bundleidentifier. Looks like there are lot of similar issues with using different bundles, but I haven not found a fix that would work for this issue.

Would be really thankful for help, thanks!



via Chebli Mohamed

After dismissing imagePickerController memory not being released

I'm calling [picker dismissViewControllerAnimated:YES completion:NULL]; when user either chooses a picture from the library or cancels. I'm also setting delegate to nil just to be sure but that doesn't help either.

Am I missing something?



via Chebli Mohamed

Mirrioing facebook comments in ios

Referring to this URL http://ift.tt/1Cb1f2a , I am searching for possibility of facebook comments mirriong in ios app. After googling, not able to get the proper docs or any links to do it in iOS. Is it possible in ios ? Any help or links will be appreciated. Thanks.



via Chebli Mohamed