IOS Ble蓝牙开发实现方法

本篇博文阐述如何开发Ble蓝牙。在蓝牙中的一些常见服务,扫描,以及链接;

  • 主蓝牙类文件.h
  • 主蓝牙类文件.m
  • UUID文件
  • 蓝牙列表展示的文件

一:引入Ble蓝牙的框架<CoreBluetooth/CoreBluetooth.h>

BuleHelp.h

#import <Foundation/Foundation.h>
//导入蓝牙框架
#import <CoreBluetooth/CoreBluetooth.h>
#import "DeviceModel.h"
#import "Constants.h"
#import "CommonUserDefaults.h"
#import "CommonUtil.h"
#import "TempDB.h"

#define COMMAND_PACKET_MIN_SIZE 7

@interface BlueHelp : NSObject

//蓝牙的设备搜索显示在列表中
@property (nonatomic,strong) NSMutableArray <CBPeripheral*>*periperals;

//连接peripheral
@property(nonatomic,strong) CBPeripheral *peripheral;

//连接peripheral
@property(nonatomic,strong) CBPeripheral *selectperipheral;

//中心管理者
@property (nonatomic,strong) CBCentralManager *centerManager;

@property (nonatomic,strong) DeviceModel *deviceModel;

//设备列表
@property (nonatomic,strong) NSMutableArray *deviceList;

@property (nonatomic,strong) NSMutableArray *commandArray;
//是否进行ota升级
@property (nonatomic) BOOL isOta;

@property (nonatomic) BOOL isWritePacketDataSuccess;

@property (strong,nonatomic) NSString * checkSumType;

/*!
 * @property isApplicationValid
 *
 * @discussion flag used to check whether the application writing is success
 *
 */
@property (nonatomic) BOOL isApplicationValid;
/*!
 * @property checkSum
 *
 * @discussion checkSum received from the device for writing a single row
 *
 */
@property (assign) uint8_t checkSum;

/*!
 * @property startRowNumber
 *
 * @discussion Device flash start row number
 *
 */
@property (nonatomic) int startRowNumber;

/*!
 * @property endRowNumber
 *
 * @discussion Device flash end row number
 *
 */
@property (nonatomic) int endRowNumber;

/*!
 * @property siliconIDString
 *
 * @discussion siliconID from the device response
 *
 */
@property (strong,nonatomic) NSString *siliconIDString;
/*!
 * @property siliconRevString
 *
 * @discussion silicon rev from the device response
 *
 */
@property (strong,nonatomic) NSString *siliconRevString;

//是否发送数据
@property (nonatomic) BOOL isSendData;

@property (strong,nonatomic) CommonUtil *commonUtil;

@property (strong,nonatomic) TempDB *tempDB;

@property (strong,nonatomic) NSDate *currentDate;

//时间格式化
@property(strong,nonatomic) NSDateFormatter *dateformatter;

@property(strong,nonatomic) NSString *deviceName;

//@property (nonatomic,strong) NSUserDefaults *userDefaults;

@property (nonatomic,strong) CommonUserDefaults *userDefaults;
//发送温度数据
@property (nonatomic,strong) CBCharacteristic *sendtempcharateristic;
//发送OTA数据
@property (nonatomic,strong) CBCharacteristic *sendotacharateristic;
//高/低温度数据
//@property (nonatomic,strong) CBCharacteristic *sendhighalarmcharateristic;
//
//@property (nonatomic,strong) CBCharacteristic *sendlowalarmcharateristic;
//ota
@property (nonatomic,strong) CBCharacteristic *senddfucharateristic;
//发送字符串'CR'清除机子上的最大值(3个字节)
@property (nonatomic,strong) CBCharacteristic *senddcrstrateristic;
//发送字符串'PD'机子关机(3个字节)
@property (nonatomic,strong) CBCharacteristic *senddoutstrateristic;
//静音
@property (strong,nonatomic) CBCharacteristic *sendmutealarmcharateristic;
//calset
@property(strong,nonatomic) CBCharacteristic *sendcalsetcharateristic;
//intervaltime
@property(strong,nonatomic) CBCharacteristic *sendintervaltimecharateristic;
//alarmswitch
@property(strong,nonatomic) CBCharacteristic *sendalarmswitchcharateristic;
//tempunit
@property(strong,nonatomic) CBCharacteristic *sendtempunitcharateristic;

@property(strong,nonatomic) CBCharacteristic *sendlowalarmswitchcharateristic;

///<===============方法区块=======================>
+ (id)sharedManager;

-(NSMutableArray *)getDeviceList;

-(NSMutableArray *)getPeriperalList;

-(void)startScan;
//连接蓝牙
-(void)contentBlue:(int) row;
//断开蓝牙
-(void)disContentBle;

//断开ota的蓝牙连接
-(void)disContentOtaBle;

//温度符号
-(void)writeTempUnit:(NSString *)value;

//写入报警开关
-(void)writeAlarmSwitch:(NSString *)value;

//写入mute alarm
-(void)writeMuteAlarm:(NSString *)value;

//写入CR CLERVULE
-(void)writeClearCR:(NSString *)value;

//写入interval time
-(void)writeIntervalTime:(NSString *)value;

//写入cal set
-(void)writeCalSet:(NSString *)value;

//写入设备的开关按钮
-(void)writeBluePD:(NSString *)value;

//写入低温报警
//-(void)writeLowAlarm:(NSString *)value;
//
////写入高温报警
//-(void)writeHighAlarm:(NSString *)value;

//OTA固件升级 又称为DFU
-(void)writeUpdateOTA:(NSString*)value;

-(void)writeBlueOTA:(NSString *)value;

-(void)wirteBlueOTAData:(NSData *)value;

-(void)writeLowAlarmSwitch:(NSString *)value;

-(void) discoverCharacteristicsWithCompletionHandler:(void (^) (BOOL success,NSError *error)) handler;

-(void)updateValueForCharacteristicWithCompletionHandler:(void (^) (BOOL success,id command,NSError *error)) handler;

-(void) stopUpdate;

-(void) setCheckSumType:(NSString *) type;

-(NSData *) createCommandPacketWithCommand:(uint8_t)commandCode dataLength:(unsigned short)dataLength data:(NSDictionary *)packetDataDictionary;

-(void) writeValueToCharacteristicWithData:(NSData *)data bootLoaderCommandCode:(unsigned short)commandCode;

/*
 * 停止扫描
 */
-(void)stopScan;

//是否是第一次连接设备
@property(assign,nonatomic) BOOL isconnected;

//当前的时间
@property(nonatomic,assign) long currentTime;

@property(nonatomic,strong) NSString *macAddre;

@property(nonatomic,strong) NSString *macName;

-(void)disMainOtaBle;

@end

BuleHelp.m

//程序运行后,会自动调用的检查蓝牙的方法 并扫描蓝牙的方法
- (void)centralManagerDidUpdateState:(CBCentralManager *)central{
 if ([central state] == CBCentralManagerStatePoweredOff) {
  NSLog(@"CoreBluetooth BLE hardware is powered off");
 }
 else if ([central state] == CBCentralManagerStatePoweredOn) {
  NSLog(@"CoreBluetooth BLE hardware is powered on and ready");
  [self startScan];
 }
 else if ([central state] == CBCentralManagerStateUnauthorized) {
  NSLog(@"CoreBluetooth BLE state is unauthorized");
 }
 else if ([central state] == CBCentralManagerStateUnknown) {
  NSLog(@"CoreBluetooth BLE state is unknown");
 }
 else if ([central state] == CBCentralManagerStateUnsupported) {
  NSLog(@"CoreBluetooth BLE hardware is unsupported on this platform");
 }
}
/*
 * 程序运行的时候开始扫描
 */
-(void)startScan{
 _periperals = [[NSMutableArray alloc] init];
 _deviceList = [[NSMutableArray alloc] init];
 //2.利用中心设备扫描外部设备
 [_centerManager scanForPeripheralsWithServices:nil options:nil];
}

/*
 * 停止扫描
 */
-(void)stopScan{
 [_centerManager stopScan];
}
/*
 * 设备中可以包含 Device addre地址 放在 key:kCBAdvDataManufacturerData中既可以得到
 * 1.硬件开发工程师 把地址写入到设备的厂家信息中。
 */

- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary<NSString *,id> *)advertisementData RSSI:(NSNumber *)RSS{
 //判断如果数组中不包含当前扫描到的外部设备才保存
 if (![_periperals containsObject:peripheral]){
  //包扣3种设备 都需要去搜索
  if([peripheral.name containsString:@"TMW012BT"]||[peripheral.name containsString:@"OTA"]){
   NSLog(@"DATA: %@",advertisementData);
   NSArray *keys = [advertisementData allKeys];
   for (int i = 0; i < [keys count]; ++i) {
    id key = [keys objectAtIndex: i];
    NSString *keyName = (NSString *) key;
    NSData *value = [advertisementData objectForKey: key];

    if([keyName isEqualToString:@"kCBAdvDataManufacturerData"]){
     NSLog(@"value is %@",value);
     NSString *result = [self convertDataToHexStr:value];
     NSLog(@"reslut is %@",result);
     if(result!=nil&&result.length>4){
      NSString *d = [result substringFromIndex:4];
      NSLog(@"D IS %@",d);
      // 小写
      //NSString *lower = [test lowercaseString];
      // 大写
      NSString *upper = [d uppercaseString];
      _macAddre = [NSString stringWithFormat:@"S/N:%@",upper];
     }
    }

    if([keyName isEqualToString:@"kCBAdvDataLocalName"]){
     NSString *aStr= (NSString*)value;
     NSLog(@"astr is %@",aStr);
     _macName = aStr;
    }
   }

   _deviceModel = [DeviceModel new];
   _deviceModel.deviceName = _macName;
   //蓝牙地址
   _deviceModel.deviceAddre = _macAddre;

   int rssi = [RSS intValue];
   NSString *range = [NSString stringWithFormat:@"%d",rssi];
   NSString *rs = [NSString stringWithFormat:@"RSSI %@dBm",range];
   //添加到里面
   [self.periperals addObject:peripheral];
   _deviceModel.deviceRssi = rs;
   [_deviceList addObject:_deviceModel];
  }
 }
}
//解析广播里面的数据
-(void)getAdvertisementData:(NSDictionary<NSString *,id> *) advertisementData{
 NSArray *keys = [advertisementData allKeys];
 for (int i = 0; i < [keys count]; ++i) {
  id key = [keys objectAtIndex: i];
  NSString *keyName = (NSString *) key;
  NSObject *value = [advertisementData objectForKey: key];

  if([keyName isEqualToString:@"kCBAdvDataManufacturerData"]){
   printf(" key: %s\n",[keyName cStringUsingEncoding: NSUTF8StringEncoding]);
   NSString *values = (NSString *) value;
   NSLog(@"values is %@",values);
  }
 }
}
/*
 * 连接蓝牙设备给外部调用的方法
 * 传入的是相对应的行数
 */
-(void)contentBlue:(int) row{
 [_centerManager connectPeripheral:_periperals[row] options:nil];
}

-(void)disContentBle{
 //关键的断开蓝牙 通知也要停止掉
 if((_peripheral!=nil && _sendtempcharateristic!=nil)){
  [_peripheral setNotifyValue:NO forCharacteristic:_sendtempcharateristic];
  [self disconnectPeripheral:_peripheral];
 }
}

/*
 * 断开ota的 连接
 */
-(void)disContentOtaBle{
 if(_peripheral!=nil && _sendotacharateristic!=nil){
  [_peripheral setNotifyValue:NO forCharacteristic:_sendotacharateristic];
  [self disconnectPeripheral:_peripheral];
 }
}

-(void)disMainOtaBle{
 if(_peripheral!=nil){
  [self disconnectPeripheral:_peripheral];
 }
}

- (void) disconnectPeripheral:(CBPeripheral*)peripheral
{
 [_centerManager cancelPeripheralConnection:peripheral];
}
//连接成功
- (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral{
 NSLog(@"连接成功");
 if(peripheral!=nil){
  //停止扫描 这个用于自动连接的时候
  [_centerManager stopScan];
  //设备名称
  _deviceName = peripheral.name;

  _selectperipheral = peripheral;

  peripheral.delegate = self;
  //再去扫描服务
  [peripheral discoverServices:nil];

 }
}
//连接失败
- (void)centralManager:(CBCentralManager *)central didFailToConnectPeripheral:(CBPeripheral *)peripheral error:(nullable NSError *)error{
 NSLog(@"连接失败,失败原因:%@",error);
 NSString *disContentBlue = @"discontentblue";
 NSDictionary *blueDiscontent = [NSDictionary dictionaryWithObject:disContentBlue forKey:@"disconnect"];
 //发送广播 连接失败
 [[NSNotificationCenter defaultCenter] postNotificationName:@"disNofiction" object:nil userInfo:blueDiscontent];
}
//断开连接
- (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error{
 NSLog(@"断开连接");
 NSString *disContentBlue = @"discontentblue";
 //_blueiscon = @"Disconnect";
 NSDictionary *blueDiscontent = [NSDictionary dictionaryWithObject:disContentBlue forKey:@"disconnect"];
 //发送广播 连接失败
 [[NSNotificationCenter defaultCenter] postNotificationName:@"disNofiction" object:nil userInfo:blueDiscontent];
}
//只要扫描到服务就会调用,其中的外设就是服务所在的外设
- (void)peripheral:(CBPeripheral *)peripheral didDiscoverServices:(NSError *)error{
 if (error){
  NSLog(@"扫描服务出现错误,错误原因:%@",error);
 }else{
  //获取外设中所扫描到的服务
  for (CBService *service in peripheral.services){
   //拿到需要扫描的服务,例如FFF0 比如打印温度数据
   //把所有的service打印出来
   //从需要的服务中查找需要的特征
   //从peripheral的services中扫描特征
   [peripheral discoverCharacteristics:nil forService:service];
  }
 }
}
//只要扫描到特征就会调用,其中的外设和服务就是特征所在的外设和服务
- (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(nonnull CBService *)service error:(nullable NSError *)error{
 if(error){
  NSLog(@"扫描特征出现错误,error);
 }else{
  //遍历特征,拿到需要的特征进行处理
  for (CBCharacteristic *characteristic in service.characteristics){
   NSLog(@"characteristic is %@",characteristic.UUID);
   //如果是温度数据处理
   if([characteristic.UUID isEqual:BOOT_TEMPVALUE_UUID]){
    //将全部的特征信息打印出来
    _isconnected = true;
    _peripheral = peripheral;
    _sendtempcharateristic = characteristic;
    [peripheral setNotifyValue:YES forCharacteristic:characteristic];
   }
   //如果是ota进行ota升级
   else if([characteristic.UUID isEqual:BOOT_OTA_WIRTE_UUID]){
    _peripheral = peripheral;
    _sendotacharateristic = characteristic;
    //设置通知
    [peripheral setNotifyValue:YES forCharacteristic:characteristic];
    _isOta = TRUE;
    [_userDefaults saveOta:_isOta];
    //[_ setBool:_isOta forKey:@"isOTA"];
    NSString *s = @"OTA";
    NSDictionary *tempOta = [NSDictionary dictionaryWithObject:s forKey:@"ota"];
    [[NSNotificationCenter defaultCenter] postNotificationName:@"tempOTA" object:nil userInfo:tempOta];
   }
   //CAL
   else if([characteristic.UUID isEqual:BOOT_CAL_UUID]){
    _sendcalsetcharateristic = characteristic;
    [peripheral setNotifyValue:YES forCharacteristic:characteristic];
   }
   //interval time
   else if([characteristic.UUID isEqual:BOOT_INTERVALTIME_UUID]){
    _sendintervaltimecharateristic = characteristic;
    [peripheral setNotifyValue:YES forCharacteristic:characteristic];
   }
   //Tempunit
   else if([characteristic.UUID isEqual:BOOT_TEMPUNIT_UUID]){
    _sendtempunitcharateristic = characteristic;
    [peripheral setNotifyValue:YES forCharacteristic:characteristic];
   }

   //DFU
   else if([characteristic.UUID isEqual:BOOT_DFU_UUID]){
    _senddfucharateristic = characteristic;
    [peripheral setNotifyValue:YES forCharacteristic:characteristic];
   }
   //发送字符串'CR'清除机子上的最大值(3个字节)
   else if([characteristic.UUID isEqual:BOOT_CRSTRING_UUID]){
    _senddcrstrateristic = characteristic;
    [peripheral setNotifyValue:YES forCharacteristic:characteristic];
   }
   //发送字符串'PD'机子关机(3个字节)
   else if([characteristic.UUID isEqual:BOOT_OUTSTRING_UUID]){
    _senddoutstrateristic = characteristic;
    [peripheral setNotifyValue:YES forCharacteristic:characteristic];
   }
   else{

   }
  }
 }
}
/*
 设置通知
 */
-(void)notifyCharacteristic:(CBPeripheral *)peripheral
    characteristic:(CBCharacteristic *)characteristic{
 [peripheral setNotifyValue:YES forCharacteristic:characteristic];
 [_centerManager stopScan];
}

/*
 取消通知
 */
-(void)cancelNotifyCharacteristic:(CBPeripheral *)peripheral
     characteristic:(CBCharacteristic *)characteristic{
 [peripheral setNotifyValue:NO forCharacteristic:characteristic];
}
/*
 接收数据解析
 */
- (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error{
 //是否为Ota
 if(!self.isSendOta){
  if(self.readtempcharater == characteristic){
   NSString *tmpData = [self.cmUtil getTempTMWData:characteristic];
   if(tmpData!=nil){
    //开始处理数据
    NSArray *data = [tmpData componentsSeparatedByString:@","];
    TmpModel *tp = [[TmpModel alloc] init];
    tp.tmp = data[0];
    tp.max = data[1];
    tp.unit = data[2];
    //电量
    tp.bat = data[3];

    NSDictionary *tempDict = [NSDictionary dictionaryWithObject:tp forKey:@"tempData"];
    [[NSNotificationCenter defaultCenter] postNotificationName:@"tempNofiction" object:nil userInfo:tempDict];
    if([tp.bat isEqual:@"1"]){
     //低电量广播
     NSDictionary *LowDict = [NSDictionary dictionaryWithObject:tp forKey:@"lowData"];
     [[NSNotificationCenter defaultCenter] postNotificationName:@"lowNofiction" object:nil userInfo:LowDict];
    }
   }
  }
 }
//======================写入数据区块========================//

/*
 写入发送时间
 */
-(void)writeIntervalTime:(NSString *)value periperalData:(CBPeripheral*)periperal{
 if(value!=nil&&periperal!=nil&&self.sendtimecharater!=nil){
  [self writeData:value forCharacteristic:self.sendtimecharater periperalData:periperal];
 }
}

/*
 写入温度单位
 */
-(void)writeTmpUnit:(NSString*)value periperalData:(CBPeripheral*)periperal{
 if(value!=nil&&periperal!=nil&&self.sendunitcharater!=nil){
  [self writeData:value forCharacteristic:self.sendunitcharater periperalData:periperal];
 }
}

/*
 写入Cal值
 */
-(void)writeCalValue:(NSString *)value periperalData:(CBPeripheral*)periperal{
 if(value!=nil&&periperal!=nil&&self.sendcalcharater!=nil){
  [self writeData:value forCharacteristic:self.sendcalcharater periperalData:periperal];
 }
}

/*
 发送Ota使得设备进入Ota
 */
-(void)writeDfuValue:(NSString *)value periperalData:(CBPeripheral*)periperal{
 if(value!=nil&&periperal!=nil&&self.senddfucharater!=nil){
  [self writeData:value forCharacteristic:self.senddfucharater periperalData:periperal];
 }
}

/*
 发送Max Temp实现清零选项
 */
-(void)writeClearValue:(NSString *)value periperalData:(CBPeripheral*)periperal{
 if(value!=nil&&periperal!=nil&&self.sendclearcharater!=nil){
  [self writeData:value forCharacteristic:self.sendclearcharater periperalData:periperal];
 }
}

/*
 发送关机选项实现远程开关机
 */
-(void)writeCloseValue:(NSString *)value periperalData:(CBPeripheral*)periperal{
 if(value!=nil&&periperal!=nil&&self.sendclosecharater!=nil){
  [self writeData:value forCharacteristic:self.sendclosecharater periperalData:periperal];
 }
}

/*
 所有写入的数据处理
 */
-(void)writeData:(NSString *)value forCharacteristic:(CBCharacteristic *)characteristic periperalData:(CBPeripheral*)periperal{
 NSData *data = [value dataUsingEncoding:NSUTF8StringEncoding];
 if(characteristic.properties & CBCharacteristicPropertyWriteWithoutResponse)
 {
  [periperal writeValue:data forCharacteristic:characteristic type:CBCharacteristicWriteWithoutResponse];
 }else
 {
  [periperal writeValue:data forCharacteristic:characteristic type:CBCharacteristicWriteWithResponse];
 }
}

此篇文章阐述到这,基本BLE蓝牙开发实现都详细的描述了。

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持我们。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple 最新软件的错误和性能问题。
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只有5%的概率会遇到选择运营商界面且部分必须连接到iTunes才可以激活
一般在接外包的时候, 通常第三方需要安装你的app进行测试(这时候你的app肯定是还没传到app store之前)。
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应用变灰了。那么接下来我们看一下Flutter是如何实现的。Flutter中实现整个App变为灰色在Flutter中实现整个App变为灰色是非常简单的,只需要在最外层的控件上包裹ColorFiltered,用法如下:ColorFiltered(颜色过滤器)看名字就知道是增加颜色滤镜效果的,ColorFiltered( colorFilter:ColorFilter.mode(Colors.grey, BlendMode.
flutter升级/版本切换
(1)在C++11标准时,open函数的文件路径可以传char指针也可以传string指针,而在C++98标准,open函数的文件路径只能传char指针;(2)open函数的第二个参数是打开文件的模式,从函数定义可以看出,如果调用open函数时省略mode模式参数,则默认按照可读可写(ios_base:in | ios_base::out)的方式打开;(3)打开文件时的mode的模式是从内存的角度来定义的,比如:in表示可读,就是从文件读数据往内存读写;out表示可写,就是把内存数据写到文件中;
文章目录方法一:分别将图片和文字置灰UIImage转成灰度图UIColor转成灰度颜色方法二:给App整体添加灰色滤镜参考App页面置灰,本质是将彩色图像转换为灰度图像,本文提供两种方法实现,一种是App整体置灰,一种是单个页面置灰,可结合具体的业务场景使用。方法一:分别将图片和文字置灰一般情况下,App页面的颜色深度是24bit,也就是RGB各8bit;如果算上Alpha通道的话就是32bit,RGBA(或者ARGB)各8bit。灰度图像的颜色深度是8bit,这8bit表示的颜色不是彩色,而是256
领导让调研下黑(灰)白化实现方案,自己调研了两天,根据网上资料,做下记录只是学习过程中的记录,还是写作者牛逼
让学前端不再害怕英语单词(二),通过本文,可以对css,js和es6的单词进行了在逻辑上和联想上的记忆,让初学者更快的上手前端代码
用Python送你一颗跳动的爱心
在uni-app项目中实现人脸识别,既使用uni-app中的live-pusher开启摄像头,创建直播推流。通过快照截取和压缩图片,以base64格式发往后端。
商户APP调用微信提供的SDK调用微信支付模块,商户APP会跳转到微信中完成支付,支付完后跳回到商户APP内,最后展示支付结果。CSDN前端领域优质创作者,资深前端开发工程师,专注前端开发,在CSDN总结工作中遇到的问题或者问题解决方法以及对新技术的分享,欢迎咨询交流,共同学习。),验证通过打开选择支付方式弹窗页面,选择微信支付或者支付宝支付;4.可取消支付,放弃支付会返回会员页面,页面提示支付取消;2.判断支付方式,如果是1,则是微信支付方式。1.判断是否在微信内支付,需要在微信外支付。
Mac命令行修改ipa并重新签名打包
首先在 iOS 设备中打开开发者模式。位于:设置 - 隐私&安全 - 开发者模式(需重启)
一 现象导入MBProgressHUD显示信息时,出现如下异常现象Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_MBProgressHUD", referenced from: objc-class-ref in ViewController.old: symbol(s) not found for architecture x86_64clang: error: linker command failed wit
Profiles >> 加号添加 >> Distribution >> "App Store" >> 选择 2.1 创建的App ID >> 选择绑定 2.3 的发布证书(.cer)>> 输入描述文件名称 >> Generate 生成描述文件 >> Download。Certificates >> 加号添加 >> "App Store and Ad Hoc" >> “Choose File...” >> 选择上一步生成的证书请求文件 >> Continue >> Download。
今天有需求,要实现的功能大致如下:在安卓和ios端实现分享功能可以分享链接,图片,文字,视频,文件,等欢迎大佬多多来给萌新指正,欢迎大家来共同探讨。如果各位看官觉得文章有点点帮助,跪求各位给点个“一键三连”,谢啦~声明:本博文章若非特殊注明皆为原创原文链接。