小编谢小进*_*谢小进的帖子

iOS如何判断应用程序是运行前台还是后台?

众所周知,如果iOS应用程序正在运行前台,那么应用程序将不会在删除通知到来时通知用户.现在在我的应用程序中,我想显示警告以通知用户远程通知到来.如何判断应用程序是运行前台还是后台?我找到了docs并搜索了stackoverflow.com,却找不到任何相关内容.谢谢.

foreground ios

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

是否会拒绝使用telprompt的应用

为了在通话后返回app,我使用telprompt而不是tel.像这样的代码:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"telprompt://10086"]];
Run Code Online (Sandbox Code Playgroud)

有人说它会被苹果拒绝,因为telpromt不是公共URL方案.但我没有找到某个答案 - 是或否.有人可以帮助我吗?

iphone-privateapi ios telprompt

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

SQLite错误:复合SELECT中的术语太多

当我向sqlite数据库文件中插入太多数据时,会发生错误"复合SELECT中的术语过多".我用" insert into ... select ... union select ... union ...".我知道它有太多的select语句,但我的问题是:复合SELECT语句中的最大术语数是多少?

sqlite select ios

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

MBProgressHUD无法覆盖键盘

当我在键盘显示时尝试显示MBProgressHUD时,我使用下面的代码,但HUD对象无法覆盖键盘:

SNSSharerAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
HUD = [[MBProgressHUD showHUDAddedTo:delegate.window animated:YES] retain];
HUD.mode = MBProgressHUDModeIndeterminate;
HUD.labelText = @"Posting...";
[HUD show:YES];
Run Code Online (Sandbox Code Playgroud)

我认为HUD对象显示在委托窗口的前面,键盘也显示,所以最后添加了,这是前面的.我错了吗?

ios mbprogresshud

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

重新排序UITableView并隐藏重新排序控件

我的问题是这样的:重新排序UITableView而没有重新排序控制,我使用这些方法:

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    return YES;
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
    return UITableViewCellEditingStyleNone;
}
- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath {
    return NO;
}
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    return YES;
}
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath{

}
Run Code Online (Sandbox Code Playgroud)

[self.tableView setEditing:YES];

......

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    ItemTableViewCell *cell = (ItemTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"ItemTableViewCell" …
Run Code Online (Sandbox Code Playgroud)

uitableview ios

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

flutter pub run build_runner构建失败

颤振版本:

flutter_macos_v1.9.1+hotfix.2-stable
Run Code Online (Sandbox Code Playgroud)

在终端中创建新项目:

flutter create myapp
Run Code Online (Sandbox Code Playgroud)

打开vscode,编辑pubspec.yaml

dependencies:
  json_annotation: ^3.0.0

dev_dependencies:
  build_runner: ^1.7.0
  json_serializable: ^3.2.2
Run Code Online (Sandbox Code Playgroud)

在终端中获取软件包:

flutter pub get
Run Code Online (Sandbox Code Playgroud)

新的/lib/user.dart和下面的填充:

import 'package:json_annotation/json_annotation.dart';

part 'user.g.dart';

@JsonSerializable()
class User extends Object {
  @JsonKey(name: 'seed')
  String seed;

  @JsonKey(name: 'results')
  int results;

  @JsonKey(name: 'page')
  int page;

  @JsonKey(name: 'version')
  String version;

  User(
    this.seed,
    this.results,
    this.page,
    this.version,
  );

  factory User.fromJson(Map<String, dynamic> srcJson) =>
      _$UserFromJson(srcJson);

  Map<String, dynamic> toJson() => _$UserToJson(this);
}
Run Code Online (Sandbox Code Playgroud)

flutter pub run build_runner build在终端中运行:

[INFO] Generating build script...
[INFO] Generating …
Run Code Online (Sandbox Code Playgroud)

dart visual-studio-code flutter

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

无法使用类型为int的rvalue初始化UIRemote NotificationType类型的参数

当我[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];用来注册远程推送通知时,发生错误说cannot initialize a parameter of type 'UIRemoteNotificationType' with an rvalue of type 'int',有人知道为什么吗?谢谢.

我的项目环境:Xcode 4.2 + iOS 5.

push-notification apple-push-notifications ios ios5

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

iOS蓝牙scanForPeripheralsWithServices没有结果

当我使用iOS蓝牙时,代码如下:

static NSString * const kServiceUUID = @"1802";
[self.manager scanForPeripheralsWithServices:@[ [CBUUID UUIDWithString:kServiceUUID] ] options:@{CBCentralManagerScanOptionAllowDuplicatesKey : @NO }];
Run Code Online (Sandbox Code Playgroud)

为什么没有回应?我在方法scanForPeripheralsWithServices中尝试了各种参数对我已经检查了这个问题: 如何获取可用蓝牙设备的列表?

我的设备是iOS 6的iPod touch 5(越狱).我已经测试了一些蓝牙4.0设备.谁能告诉我为什么?

bluetooth ios core-bluetooth bluetooth-lowenergy

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

iOS怎么玩midi笔记?

我已经搜索过并且已经完成了可以播放MIDI音符的OS X应用程序,但是当我在iOS中尝试时,什么都没发生.这是核心代码:

AUGraph graph;
AudioUnit synthUnit;
AUNode synthNode, outNode;

NewAUGraph(&graph);

AudioComponentDescription cd;
cd.componentManufacturer = kAudioUnitManufacturer_Apple;

cd.componentType = kAudioUnitType_MusicDevice;
cd.componentSubType = kAudioUnitSubType_MIDISynth;
AUGraphAddNode(graph, &cd, &synthNode);

cd.componentType = kAudioUnitType_Output;
cd.componentSubType = kAudioUnitSubType_GenericOutput;
AUGraphAddNode(graph, &cd, &outNode), "AUGraphAddNode");

CheckError(AUGraphOpen(graph), "AUGraphOpen");

AUGraphConnectNodeInput(graph, synthNode, 0, outNode, 0);

AUGraphNodeInfo(graph, synthNode, 0, &synthUnit);

AUGraphInitialize(graph);
CAShow(graph);

AUGraphStart(graph);

CFURLRef bankURL = ... //gs_instruments.dls
AudioUnitSetProperty(synthUnit,
                    kMusicDeviceProperty_SoundBankURL,
                    kAudioUnitScope_Global,
                    0,
                    &bankURL,
                    sizeof(bankURL));

static UInt32 kChannelMessage_NoteOn = 0x90;
UInt8 channel = 0;
UInt8 note = 60;
UInt32 velocity = 127;

MusicDeviceMIDIEvent(synthUnit,
                    kChannelMessage_NoteOn | channel, …
Run Code Online (Sandbox Code Playgroud)

midi core-audio audiotoolbox audiounit ios

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

如何在Xcode 4中设置UITableViewCell标识符

在Xcode 4中,我未能找到设置UITableViewCell标识符的位置,有人可以帮助我吗?非常感谢你.

identifier ios xcode4

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

PJSIP 构建问题

环境:OS X 10.9.3, Xcode 5.1, PJSIP-2.2.1 我想搭建一个简单的PJSIP,shell脚本如下:

#!/bin/bash

SOURCE="pjproject-2.2.1"
CONFIG="pjlib/include/pj/config_site.h"

if [ ! -r $SOURCE ]; then
    echo 'PJSIP source not found. Trying to untar...'
    tar -xjf $SOURCE.tar.bz2
fi

cd $SOURCE

touch $CONFIG
echo > $CONFIG
echo "#define PJ_CONFIG_IPHONE 1" >> $CONFIG
echo "#include <pj/config_site_sample.h>" >> $CONFIG

./configure-iphone
#make dep && make clean && make

echo Done.
Run Code Online (Sandbox Code Playgroud)

它运行正常并创建了 .a 文件,例如pjlib/lib/libpj-arm-apple-darwin9. 但是,当我用它们来我的iOS项目,它失败了Endianness must be declared for this processorPJ_IS_LITTLE_ENDIAN is not defined!PJ_IS_BIG_ENDIAN is not defined! …

xcode compilation build pjsip ios

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