Skip to content

Instantly share code, notes, and snippets.

if error != nil {
print(“服務加入失敗: \(error!.localizedDescription)”)
return
}
peripheralManager?.startAdvertising([CBAdvertisementDataServiceUUIDsKey: [service.uuid]])
peripheral.updateValue("哈囉你好嗎~".data(using: .utf8)!,
for: characteristic as! CBMutableCharacteristic,
onSubscribedCentrals: nil)
{
"name": "HelloReactNativeDemo",
"displayName": "HelloReactNativeDemo"
}
export default class HelloReactNativeDemo extends Component {
}
AppRegistry.registerComponent(‘HelloReactNativeDemo’, () => HelloReactNativeDemo);
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"HelloReactNativeDemo"
initialProperties:nil
launchOptions:launchOptions];
<key>CFBundleDisplayName</key>
<string>HelloReactNativeDemo</string>
{
"name": "HelloReactNativeDemo",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "15.4.2",
while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
return YES;
}
return NO;
}];
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// 先省略上面幾行程式碼
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;