Ios ipv6 don';我没有收到邀请

Ios ipv6 don';我没有收到邀请,ios,objective-c,multipeer-connectivity,Ios,Objective C,Multipeer Connectivity,我的应用被苹果拒绝,因为它无法连接到其他运行iOS 10.1.1的设备,该设备通过Wi-Fi连接到IPv6网络。 当我点击connect时,应用程序会继续搜索被邀请者,不会产生进一步的用户操作。 我使用多点连接,从未测试过我的应用程序是否连接到IPv6(这是我的第一个版本)。但该应用程序运行非常良好,没有任何连接或连接到IPv4网络 我不知道为什么该应用程序使用IPv4运行和连接良好,如果iPad连接到IPv6网络,则无法连接到对等网络 因此,我的问题是:是否有可能使用IPv6的多点连接,以便苹

我的应用被苹果拒绝,因为它无法连接到其他运行iOS 10.1.1的设备,该设备通过Wi-Fi连接到IPv6网络。
当我点击connect时,应用程序会继续搜索被邀请者,不会产生进一步的用户操作。
我使用多点连接,从未测试过我的应用程序是否连接到IPv6(这是我的第一个版本)。但该应用程序运行非常良好,没有任何连接或连接到IPv4网络

我不知道为什么该应用程序使用IPv4运行和连接良好,如果iPad连接到IPv6网络,则无法连接到对等网络

因此,我的问题是:是否有可能使用IPv6的多点连接,以便苹果可以批准该应用程序,或者我应该如何处理这个问题

这是我的代码,可能是出了什么问题

@interface ConnectionManageriOS7 () <MCSessionDelegate, MCBrowserViewControllerDelegate>
{ 
    UILocalNotification *_expireNotification;
    UIBackgroundTaskIdentifier _taskId;
}

@property (nonatomic, strong) MCSession *session;
@property (nonatomic, strong) MCPeerID *localPeerID;

@property (nonatomic, strong) MCBrowserViewController *browserVC;
@property (nonatomic, strong) MCAdvertiserAssistant *advertiser;

@end

static ConnectionManageriOS7 *_manager = nil;

@implementation ConnectionManageriOS7

+ (ConnectionManageriOS7 *)connectManager {

    @synchronized([ConnectionManageriOS7 class]){

        if (_manager == nil) {
            _manager = [[ConnectionManageriOS7 alloc] init];
        }
        return _manager;
    }
    return nil;
}

- (id)init {

    self = [super init];
    if (self) {
        [self setupSessionAndAdvertiser];
    }
    return self;
}

- (void)setupSessionAndAdvertiser {

    _localPeerID = [[MCPeerID alloc] initWithDisplayName:[UIDevice currentDevice].name];;
    _session = [[MCSession alloc] initWithPeer:_localPeerID];
    _session.delegate = self;

}

- (void)connectWithDelegate:(id)delegate {

    _delegate = delegate;
    if (_session.connectedPeers.count) {
        if ([_delegate respondsToSelector:@selector(didConntectedWithManager:)]) {
            [_delegate didConntectedWithManager:self];
        }
    } else {
        if (_advertiser == nil) {
            _advertiser = [[MCAdvertiserAssistant alloc] initWithServiceType:VISUS_Service
                                                               discoveryInfo:nil
                                                                     session:_session];

            _isConnected = NO;

            [_advertiser start];
        }
        if (_browserVC == nil) {

            _browserVC = [[MCBrowserViewController alloc] initWithServiceType:VISUS_Service session:_session];
            _browserVC.delegate = self;

        }

        [(UIViewController *)delegate presentViewController:_browserVC
                                                   animated:YES completion:nil];
    }
}

- (void)sendMessage:(NSString *)message {

    NSData *textData = [message dataUsingEncoding:NSASCIIStringEncoding];
    NSLog(@"Send Data: %@", message);
    NSError *error = nil;
    [_session sendData:textData
               toPeers:_session.connectedPeers
              withMode:MCSessionSendDataReliable
                 error:&error];

    if (error) {
        //        
        [self session:_session peer:nil didChangeState:MCSessionStateNotConnected];
        NSLog(@"error %@", error.userInfo);
    }
}

- (void)stopService {

    NSLog(@"Stop Service");

    [_advertiser stop];
    _advertiser = nil;

    _browserVC = nil;
}

#pragma marks -
#pragma marks MCBrowserViewControllerDelegate
- (void) dismissBrowserVC{
    [_browserVC dismissViewControllerAnimated:YES completion:nil];
}
// Notifies the delegate, when the user taps the done button
- (void)browserViewControllerDidFinish:(MCBrowserViewController *)browserViewController {

    if ([_delegate respondsToSelector:@selector(didConntectedWithManager:)]) {
        [_delegate didConntectedWithManager:self];
    }

    [self dismissBrowserVC];
}

// Notifies delegate that the user taps the cancel button.
- (void)browserViewControllerWasCancelled:(MCBrowserViewController *)browserViewController{
    if (_browserVC == nil) {
        [browserViewController dismissViewControllerAnimated:YES completion:nil];
    }else {
        [self dismissBrowserVC];
    }
}

#pragma marks -
#pragma marks MCBrowserViewControllerDelegate

- (void)session:(MCSession *)session peer:(MCPeerID *)peerID didChangeState:(MCSessionState)state {

    if (state != MCSessionStateConnecting) {
        if (state == MCSessionStateConnected) {

            _isConnected = true;
            if ([_delegate respondsToSelector:@selector(willConntectedWithManager:)]) {
                [_delegate willConntectedWithManager:self];
            }
        }
        else {

            _isConnected = false;
            [self stopService];
            if ([_delegate respondsToSelector:@selector(didDisconntectedWithManager:)]) {
                [_delegate didDisconntectedWithManager:self];
            }
        }

    }

}

// Received data from remote peer
- (void)session:(MCSession *)session didReceiveData:(NSData *)data fromPeer:(MCPeerID *)peerID{
    //  Decode data back to NSString

    NSString *message = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];

    NSLog(@"Receive Data: %@", message);

    //  append message to text box:
    dispatch_async(dispatch_get_main_queue(), ^{
        if ([_delegate respondsToSelector:@selector(connectionManager:receivedString:)]) {
            [_delegate connectionManager:self receivedString:message];
        }
    });
}

- (void)session:(MCSession *)session didFinishReceivingResourceWithName:(NSString *)resourceName fromPeer:(MCPeerID *)peerID atURL:(NSURL *)localURL withError:(NSError *)error {

    _isConnected = false;
    [self stopService];
    NSLog(@"----- Error ----- %@", error.localizedDescription);

}

// Received a byte stream from remote peer
- (void)session:(MCSession *)session didReceiveStream:(NSInputStream *)stream withName:(NSString *)streamName fromPeer:(MCPeerID *)peerID {

}

// Start receiving a resource from remote peer
- (void)session:(MCSession *)session didStartReceivingResourceWithName:(NSString *)resourceName fromPeer:(MCPeerID *)peerID withProgress:(NSProgress *)progress {

}

- (void) session:(MCSession *)session didReceiveCertificate:(NSArray *)certificate fromPeer:(MCPeerID *)peerID certificateHandler:(void (^)(BOOL accept))certificateHandler
{
    certificateHandler(YES);
}


- (void) createExpireNotification
{
    [self killExpireNotification];

    if (_session.connectedPeers.count != 0) // if peers connected, setup kill switch
    {
        NSTimeInterval gracePeriod = 20.0f;

        // create notification that will get the user back into the app when the background process time is about to expire
        NSTimeInterval msgTime = UIApplication.sharedApplication.backgroundTimeRemaining - gracePeriod;
        UILocalNotification* n = [[UILocalNotification alloc] init];
        _expireNotification = n;
        _expireNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:msgTime];
        _expireNotification.alertBody = @"Bluetooth Connectivity is about to disconnect. Open the app to resume Test";
        _expireNotification.soundName = UILocalNotificationDefaultSoundName;
        _expireNotification.applicationIconBadgeNumber = 1;

        [UIApplication.sharedApplication scheduleLocalNotification:_expireNotification];
    }
}

- (void) killExpireNotification
{
    if (_expireNotification != nil)
    {
        [UIApplication.sharedApplication cancelLocalNotification:_expireNotification];
        _expireNotification = nil;
    }
}

- (void)bacgroundHandling {

    _taskId = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^
               {
                   [self stopService];
                   [[UIApplication sharedApplication] endBackgroundTask:_taskId];
                   _taskId = UIBackgroundTaskInvalid;
               }];
    [self createExpireNotification];

}

- (void)advertiser:(MCNearbyServiceAdvertiser *)advertiser didReceiveInvitationFromPeer:(MCPeerID *)peerID withContext:(NSData *)context invitationHandler:(void(^)(BOOL accept, MCSession *session))invitationHandler
{

    // http://down.vcnc.co.kr/WWDC_2013/Video/708.pdf  -- wwdc tutorial, this part is towards the end (p119)

   // self.arrayInvitationHandler = [NSArray arrayWithObject:[invitationHandler copy]];
    // ask the user
    UIAlertView *alertView = [[UIAlertView alloc]
                              initWithTitle:peerID.displayName
                              message:@"Would like to create a session with you"
                              delegate:self
                              cancelButtonTitle:@"Decline" otherButtonTitles:@"Accept", nil];
    [alertView show];


}

- (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    // retrieve the invitationHandler and  check whether the user accepted or declined the invitation...

    BOOL accept = (buttonIndex != alertView.cancelButtonIndex) ? YES : NO;

    // respond
    if(accept) {
//        void (^invitationHandler)(BOOL, MCSession *) = [self.arrayInvitationHandler objectAtIndex:0];
//        invitationHandler(accept, self.mySession);
    }
    else
    {
        NSLog(@"Session disallowed");
    }
}

- (void)terminate {

    [self killExpireNotification];
    [self stopService];
}
@end
@接口连接管理器7()
{ 
UILocalNotification*_到期通知;
UIBackgroundTaskIdentifier\u taskId;
}
@属性(非原子,强)MCSession*会话;
@属性(非原子,强)MCPERID*localPeerID;
@属性(非原子,强)MCBrowserViewController*browserVC;
@属性(非原子,强)McAdvertiseAssistant*广告客户;
@结束
静态连接管理器7*_manager=nil;
@实现连接管理器7
+(连接管理器7*)连接管理器{
@已同步([ConnectionManager类]){
如果(_manager==nil){
_manager=[[ConnectionManageriOS7 alloc]init];
}
返回(u经理),;
}
返回零;
}
-(id)init{
self=[super init];
如果(自我){
[自我设置会话和广告];
}
回归自我;
}
-(无效)设置会话和广告{
_localPeerID=[[McPeerind alloc]initWithDisplayName:[UIDevice currentDevice].name];;
_session=[[MCSession alloc]initWithPeer:_localPeerID];
_session.delegate=self;
}
-(无效)connectWithDelegate:(id)delegate{
_代表=代表;
if(_session.connectedPeers.count){
if([\u delegate respondsToSelector:@selector(didcontectedwithmanager:)])){
[_代表未与经理联系:self];
}
}否则{
如果(_广告客户==nil){
_广告客户=[[McAdvertiseAssistant alloc]InitWithService类型:VISUS_服务
发现信息:无
会议:_会议];
_断开连接=否;
[_广告商开始];
}
如果(_browserVC==nil){
_browserVC=[[MCBrowserViewController alloc]initWithServiceType:VISUS_服务会话:_会话];
_browserVC.delegate=self;
}
[(UIViewController*)委托呈现ViewController:\u browserVC
动画:是完成:无];
}
}
-(无效)sendMessage:(NSString*)消息{
NSData*textData=[消息数据使用编码:NSASCIIStringEncoding];
NSLog(@“发送数据:%@”,消息);
n错误*错误=nil;
[\u会话发送数据:textData
toPeers:\u session.connectedPeers
withMode:MCSessionSendDataReliable
错误:&错误];
如果(错误){
//        
[self session:_sessionpeer:nil didChangeState:MCSessionStateNotConnected];
NSLog(@“error%@”,error.userInfo);
}
}
-(无效)停止服务{
NSLog(“停止服务”);
[广告商停止];
_广告客户=零;
_browserVC=nil;
}
#布拉格标记-
#pragma标记McBrowserveWControllerDelegate
-(无效)解雇{
[_browservcdismissviewcontrolleranimated:YES完成:nil];
}
//当用户点击“完成”按钮时通知代理
-(无效)浏览服务控制器IDfinish:(MCBrowserViewController*)浏览服务控制器{
if([\u delegate respondsToSelector:@selector(didcontectedwithmanager:)])){
[_代表未与经理联系:self];
}
[自我解散];
}
//通知代理用户点击取消按钮。
-(无效)已取消浏览服务控制器:(MCBrowserViewController*)浏览服务控制器{
如果(_browserVC==nil){
[browserViewController解除ViewController激活:是完成:无];
}否则{
[自我解散];
}
}
#布拉格标记-
#pragma标记McBrowserveWControllerDelegate
-(void)session:(MCSession*)session peer:(mcpeirid*)peerID didChangeState:(MCSessionState)state{
如果(状态!=MCSessionStateConnecting){
如果(状态==MCSessionStateConnected){
_断开连接=正确;
if([\u委托响应选择器:@selector(willcontectedwithmanager:)])){
[_代表将与经理联系:self];
}
}
否则{
_断开连接=错误;
[自助服务];
if([\u delegate respondsToSelector:@selector(diddisconnectedwithmanager:)])){
[_代表未与经理断开连接:self];
}
}
}
}
//从远程对等方接收数据
-(void)session:(MCSession*)session didReceiveData:(NSData*)来自peer的数据:(MCPERID*)peerID{
//将数据解码回NSString
NSString*消息=[[NSString alloc]initWithData:数据编码:NSUTF8STRINGENCONDING];
NSLog(@“接收数据:%@”,消息);
//将消息附加到文本框:
dispatch\u async(dispatch\u get\u main\u queue()^{
if([_delegaterespondstoselector:@selector(connectionManager:receivedString:)])){
[\u委托连接管理器:自我接收字符串:消息];
}
});
}
-(void)session:(MCSession*)session未完成接收ResourceWithName:(NSString*)来自对等方的resourceName:(mcpeirId*)peerID atURL:(NSURL*)本地URL withError:(NSError*)错误{
_断开连接=错误;
[自助服务];
NSLog(@“-----错误------%@”,Error.localizedDescription);
}
//从远程对等方接收到字节流
-(无效)会议:(会议)*